From 3cfd677a467264b1f838ddbd3c1b94cf4c7882a4 Mon Sep 17 00:00:00 2001 From: Luke Hagar Date: Mon, 9 Sep 2024 18:15:22 +0000 Subject: [PATCH] regenerated with new spec --- .speakeasy/gen.lock | 2455 +++++++++---- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 19 +- .speakeasy/workflow.yaml | 4 +- CONTRIBUTING.md | 26 + README.md | 194 +- USAGE.md | 2 +- activities.go | 375 +- authentication.go | 882 ++++- butler.go | 922 ++++- codeSamples.yaml | 3156 +++++++++-------- docs/models/components/security.md | 2 +- docs/models/operations/applyupdatesrequest.md | 2 +- docs/models/operations/autoselectsubtitle.md | 11 + docs/models/operations/billing.md | 9 + docs/models/operations/connections.md | 14 + .../createplaylistqueryparamtype.md | 12 + .../operations/createplaylistrequest.md | 14 +- .../defaultsubtitleaccessibility.md | 11 + .../operations/defaultsubtitleforced.md | 11 + .../models/operations/deletelibraryrequest.md | 6 +- docs/models/operations/feature.md | 10 + docs/models/operations/features.md | 66 + docs/models/operations/filter.md | 13 +- docs/models/operations/force.md | 6 +- docs/models/operations/friend.md | 19 + docs/models/operations/geodata.md | 20 + .../operations/getalllibrariesdirectory.md | 28 + .../getalllibrariesmediacontainer.md | 11 + .../operations/getalllibrariesresponse.md | 11 + .../operations/getalllibrariesresponsebody.md | 10 + .../operations/getbannerimagerequest.md | 13 + .../operations/getbannerimageresponse.md | 12 + .../operations/getcompanionsdataresponse.md | 11 + docs/models/operations/getgeodatageodata.md | 20 + ...nresponsebody.md => getgeodataresponse.md} | 24 +- .../operations/getlibrariesdirectory.md | 28 - .../models/operations/getlibrarieslocation.md | 9 - .../operations/getlibrariesmediacontainer.md | 11 - .../models/operations/getlibrariesresponse.md | 11 - .../operations/getlibrariesresponsebody.md | 10 - ...ctory.md => getlibrarydetailsdirectory.md} | 2 +- ...ryfilter.md => getlibrarydetailsfilter.md} | 2 +- .../getlibrarydetailsmediacontainer.md | 22 + ...request.md => getlibrarydetailsrequest.md} | 4 +- .../operations/getlibrarydetailsresponse.md | 11 + .../getlibrarydetailsresponsebody.md | 10 + .../operations/getlibrarydetailstype.md | 14 + .../operations/getlibraryitemsrequest.md | 14 +- .../operations/getlibrarymediacontainer.md | 22 - docs/models/operations/getlibraryresponse.md | 11 - .../operations/getlibraryresponsebody.md | 10 - docs/models/operations/getlibrarytype.md | 14 - .../operations/getmediaprovidersdirectory.md | 21 + .../getmediaprovidersmediacontainer.md | 51 + .../operations/getmediaprovidersrequest.md | 8 + .../operations/getmediaprovidersresponse.md | 11 + .../getmediaprovidersresponsebody.md | 10 + ...ry.md => getmetadatabyratingkeycountry.md} | 2 +- ...r.md => getmetadatabyratingkeydirector.md} | 2 +- ...enre.md => getmetadatabyratingkeygenre.md} | 2 +- .../operations/getmetadatabyratingkeymedia.md | 24 + .../getmetadatabyratingkeymediacontainer.md | 16 + ...a.md => getmetadatabyratingkeymetadata.md} | 14 +- ...apart.md => getmetadatabyratingkeypart.md} | 2 +- ...st.md => getmetadatabyratingkeyrequest.md} | 8 +- .../getmetadatabyratingkeyresponse.md | 11 + .../getmetadatabyratingkeyresponsebody.md | 10 + ...arole.md => getmetadatabyratingkeyrole.md} | 2 +- ...ter.md => getmetadatabyratingkeywriter.md} | 2 +- docs/models/operations/getmetadatamedia.md | 24 - .../operations/getmetadatamediacontainer.md | 16 - docs/models/operations/getmetadataresponse.md | 11 - .../operations/getmetadataresponsebody.md | 10 - .../operations/getpinauthpincontainer.md | 21 + docs/models/operations/getpinglobals.md | 2 +- docs/models/operations/getpinrequest.md | 4 +- docs/models/operations/getpinresponse.md | 12 +- .../getplaylistcontentsqueryparamtype.md | 19 + .../operations/getplaylistcontentsrequest.md | 8 +- .../operations/getrecentlyaddedrequest.md | 9 + .../getrefreshlibrarymetadatarequest.md | 9 + ...d => getrefreshlibrarymetadataresponse.md} | 2 +- .../getsearchlibrarymediacontainer.md | 20 + ...etadata.md => getsearchlibrarymetadata.md} | 2 +- .../operations/getsearchlibraryrequest.md | 9 + .../operations/getsearchlibraryresponse.md | 11 + .../getsearchlibraryresponsebody.md | 10 + .../operations/getserverresourcesglobals.md | 8 + .../operations/getserverresourcesrequest.md | 12 + .../operations/getserverresourcesresponse.md | 11 + .../operations/getsessionhistoryrequest.md | 2 +- .../models/operations/getthumbimagerequest.md | 13 + .../operations/getthumbimageresponse.md | 12 + .../gettokenbypinidauthpincontainer.md | 21 + .../operations/gettokenbypinidgeodata.md | 20 + ...englobals.md => gettokenbypinidglobals.md} | 4 +- ...enrequest.md => gettokenbypinidrequest.md} | 6 +- .../operations/gettokenbypinidresponse.md | 11 + docs/models/operations/gettokenlocation.md | 17 - docs/models/operations/gettokenresponse.md | 11 - .../models/operations/gettokenresponsebody.md | 21 - .../gettopwatchedcontentqueryparamtype.md | 19 + .../operations/gettopwatchedcontentrequest.md | 8 +- ...userdetailsauthenticationresponsestatus.md | 11 + .../getuserdetailsauthenticationstatus.md | 11 + .../operations/getuserdetailsfeatures.md | 66 + .../operations/getuserdetailsrequest.md | 8 + .../operations/getuserdetailsresponse.md | 11 + .../models/operations/getuserdetailsstatus.md | 9 + .../operations/getuserdetailssubscription.md | 13 + .../getuserdetailsuserplexaccount.md | 49 + .../operations/getuserfriendsresponse.md | 11 + docs/models/operations/getwatchlistrequest.md | 24 +- .../models/operations/getwatchlistresponse.md | 4 +- .../operations/getwatchlistresponsebody.md | 2 +- docs/models/operations/includeguids.md | 12 + docs/models/operations/includehttps.md | 11 + docs/models/operations/includeipv6.md | 11 + docs/models/operations/includemeta.md | 12 + docs/models/operations/includerelay.md | 13 + .../operations/internalpaymentmethod.md | 7 + docs/models/operations/location.md | 16 +- docs/models/operations/mailingliststatus.md | 11 + docs/models/operations/mediaprovider.md | 12 + .../operations/mediareviewsvisibility.md | 9 + docs/models/operations/option.md | 4 +- docs/models/operations/pastsubscription.md | 22 + docs/models/operations/pathparamfilter.md | 12 - docs/models/operations/pivot.md | 13 + docs/models/operations/plexdevice.md | 31 + ...stuserssignindataauthenticationfeatures.md | 66 + ...ssignindataauthenticationresponsestatus.md | 11 + ...postuserssignindataauthenticationstatus.md | 11 + ...erssignindataauthenticationsubscription.md | 13 + .../postuserssignindataautoselectsubtitle.md | 11 + ...ssignindatadefaultsubtitleaccessibility.md | 11 + ...ostuserssignindatadefaultsubtitleforced.md | 11 + .../operations/postuserssignindatafeatures.md | 66 + .../operations/postuserssignindataglobals.md | 8 + .../postuserssignindatamailingliststatus.md | 11 + ...stuserssignindatamediareviewsvisibility.md | 9 + .../operations/postuserssignindatarequest.md | 9 + .../postuserssignindatarequestbody.md | 13 + .../operations/postuserssignindataresponse.md | 11 + .../operations/postuserssignindataservices.md | 12 + .../operations/postuserssignindatastate.md | 8 + .../operations/postuserssignindatastatus.md | 9 + .../postuserssignindatasubscription.md | 15 + .../postuserssignindatauserplexaccount.md | 51 + .../postuserssignindatauserprofile.md | 15 + .../postuserssignindatawatchedindicator.md | 9 + docs/models/operations/queryparamfilter.md | 11 + docs/models/operations/queryparamforce.md | 15 + docs/models/operations/queryparamtype.md | 15 +- .../operations/refreshlibraryrequest.md | 8 - docs/models/operations/responsebody.md | 13 + .../operations/searchlibrarymediacontainer.md | 20 - .../models/operations/searchlibraryrequest.md | 9 - .../operations/searchlibraryresponse.md | 11 - .../operations/searchlibraryresponsebody.md | 10 - docs/models/operations/services.md | 12 + docs/models/operations/sharedservers.md | 7 + docs/models/operations/sharedsources.md | 7 + docs/models/operations/skip.md | 2 +- docs/models/operations/statisticsbandwidth.md | 2 +- docs/models/operations/status.md | 10 + docs/models/operations/subscription.md | 15 + docs/models/operations/trials.md | 7 + docs/models/operations/type.md | 8 +- .../operations/uploadplaylistrequest.md | 2 +- docs/models/operations/userprofile.md | 15 + docs/models/operations/watchedindicator.md | 9 + .../sdkerrors/addplaylistcontentserrors.md | 10 +- .../addplaylistcontentsplaylistserrors.md | 10 + ...ddplaylistcontentsplaylistsresponsebody.md | 11 + .../addplaylistcontentsresponsebody.md | 2 +- docs/models/sdkerrors/applyupdateserrors.md | 10 +- .../sdkerrors/applyupdatesresponsebody.md | 2 +- .../sdkerrors/applyupdatesupdatererrors.md | 10 + .../applyupdatesupdaterresponsebody.md | 11 + .../cancelserveractivitiesactivitieserrors.md | 10 + ...lserveractivitiesactivitiesresponsebody.md | 11 + .../sdkerrors/cancelserveractivitieserrors.md | 10 +- .../cancelserveractivitiesresponsebody.md | 2 +- .../models/sdkerrors/checkforupdateserrors.md | 10 +- .../sdkerrors/checkforupdatesresponsebody.md | 2 +- .../sdkerrors/checkforupdatesupdatererrors.md | 10 + .../checkforupdatesupdaterresponsebody.md | 11 + .../sdkerrors/clearplaylistcontentserrors.md | 10 +- .../clearplaylistcontentsplaylistserrors.md | 10 + ...arplaylistcontentsplaylistsresponsebody.md | 11 + .../clearplaylistcontentsresponsebody.md | 2 +- docs/models/sdkerrors/createplaylisterrors.md | 10 +- .../createplaylistplaylistserrors.md | 10 + .../createplaylistplaylistsresponsebody.md | 11 + .../sdkerrors/createplaylistresponsebody.md | 2 +- docs/models/sdkerrors/deletelibraryerrors.md | 10 +- .../sdkerrors/deletelibrarylibraryerrors.md | 10 + .../deletelibrarylibraryresponsebody.md | 11 + .../sdkerrors/deletelibraryresponsebody.md | 2 +- docs/models/sdkerrors/deleteplaylisterrors.md | 10 +- .../deleteplaylistplaylistserrors.md | 10 + .../deleteplaylistplaylistsresponsebody.md | 11 + .../sdkerrors/deleteplaylistresponsebody.md | 2 +- .../sdkerrors/enablepapertrailerrors.md | 10 +- .../sdkerrors/enablepapertraillogerrors.md | 10 + .../enablepapertraillogresponsebody.md | 11 + .../sdkerrors/enablepapertrailresponsebody.md | 2 +- docs/models/sdkerrors/errors.md | 10 +- .../models/sdkerrors/getalllibrarieserrors.md | 10 + .../sdkerrors/getalllibrarieslibraryerrors.md | 10 + .../getalllibrarieslibraryresponsebody.md | 11 + .../sdkerrors/getalllibrariesresponsebody.md | 11 + .../sdkerrors/getavailableclientserrors.md | 10 +- .../getavailableclientsresponsebody.md | 2 +- .../getavailableclientsservererrors.md | 10 + .../getavailableclientsserverresponsebody.md | 11 + .../sdkerrors/getbandwidthstatisticserrors.md | 10 +- .../getbandwidthstatisticsresponsebody.md | 2 +- .../getbandwidthstatisticsstatisticserrors.md | 10 + ...ndwidthstatisticsstatisticsresponsebody.md | 11 + docs/models/sdkerrors/getbannerimageerrors.md | 10 + .../sdkerrors/getbannerimagemediaerrors.md | 10 + .../getbannerimagemediaresponsebody.md | 11 + .../sdkerrors/getbannerimageresponsebody.md | 11 + .../sdkerrors/getbutlertasksbutlererrors.md | 10 + .../getbutlertasksbutlerresponsebody.md | 11 + docs/models/sdkerrors/getbutlertaskserrors.md | 10 +- .../sdkerrors/getbutlertasksresponsebody.md | 2 +- .../sdkerrors/getcompanionsdataerrors.md | 10 + .../sdkerrors/getcompanionsdataplexerrors.md | 10 + .../getcompanionsdataplexresponsebody.md | 11 + .../getcompanionsdataresponsebody.md | 11 + docs/models/sdkerrors/getdeviceserrors.md | 10 +- .../sdkerrors/getdevicesresponsebody.md | 2 +- .../sdkerrors/getdevicesservererrors.md | 10 + .../sdkerrors/getdevicesserverresponsebody.md | 11 + docs/models/sdkerrors/getfilehasherrors.md | 10 +- .../sdkerrors/getfilehashlibraryerrors.md | 10 + .../getfilehashlibraryresponsebody.md | 11 + .../sdkerrors/getfilehashresponsebody.md | 2 +- ...{gettokenerrors.md => getgeodataerrors.md} | 6 +- ...arieserrors.md => getgeodataplexerrors.md} | 6 +- ...ebody.md => getgeodataplexresponsebody.md} | 4 +- .../sdkerrors/getgeodataresponsebody.md | 11 + docs/models/sdkerrors/getglobalhubserrors.md | 10 +- ...tyerrors.md => getglobalhubshubserrors.md} | 6 +- .../getglobalhubshubsresponsebody.md | 11 + .../sdkerrors/getglobalhubsresponsebody.md | 2 +- docs/models/sdkerrors/gethomedataerrors.md | 10 +- ...raryerrors.md => gethomedataplexerrors.md} | 6 +- .../sdkerrors/gethomedataplexresponsebody.md | 11 + .../sdkerrors/gethomedataresponsebody.md | 2 +- .../sdkerrors/getlibrariesresponsebody.md | 11 - .../sdkerrors/getlibrarydetailserrors.md | 10 + .../getlibrarydetailslibraryerrors.md | 10 + .../getlibrarydetailslibraryresponsebody.md | 11 + .../getlibrarydetailsresponsebody.md | 11 + docs/models/sdkerrors/getlibraryhubserrors.md | 10 +- .../sdkerrors/getlibraryhubshubserrors.md | 10 + .../getlibraryhubshubsresponsebody.md | 11 + .../sdkerrors/getlibraryhubsresponsebody.md | 2 +- .../models/sdkerrors/getlibraryitemserrors.md | 10 +- .../sdkerrors/getlibraryitemslibraryerrors.md | 10 + .../getlibraryitemslibraryresponsebody.md | 11 + .../sdkerrors/getlibraryitemsresponsebody.md | 2 +- .../sdkerrors/getmediaproviderserrors.md | 10 + .../getmediaprovidersresponsebody.md | 11 + .../getmediaprovidersservererrors.md | 10 + .../getmediaprovidersserverresponsebody.md | 11 + .../sdkerrors/getmetadatabyratingkeyerrors.md | 10 + .../getmetadatabyratingkeylibraryerrors.md | 10 + ...tmetadatabyratingkeylibraryresponsebody.md | 11 + .../getmetadatabyratingkeyresponsebody.md | 11 + .../sdkerrors/getmetadatachildrenerrors.md | 10 +- .../getmetadatachildrenlibraryerrors.md | 10 + .../getmetadatachildrenlibraryresponsebody.md | 11 + .../getmetadatachildrenresponsebody.md | 2 +- .../sdkerrors/getmetadataresponsebody.md | 11 - .../sdkerrors/getmyplexaccounterrors.md | 10 +- .../sdkerrors/getmyplexaccountresponsebody.md | 2 +- .../sdkerrors/getmyplexaccountservererrors.md | 10 + .../getmyplexaccountserverresponsebody.md | 11 + docs/models/sdkerrors/getondeckerrors.md | 10 +- .../sdkerrors/getondecklibraryerrors.md | 10 + .../sdkerrors/getondecklibraryresponsebody.md | 11 + .../models/sdkerrors/getondeckresponsebody.md | 2 +- docs/models/sdkerrors/getpinerrors.md | 4 +- docs/models/sdkerrors/getpinresponsebody.md | 2 +- .../sdkerrors/getplaylistcontentserrors.md | 10 +- .../getplaylistcontentsplaylistserrors.md | 10 + ...etplaylistcontentsplaylistsresponsebody.md | 11 + .../getplaylistcontentsresponsebody.md | 2 +- docs/models/sdkerrors/getplaylisterrors.md | 10 +- .../sdkerrors/getplaylistplaylistserrors.md | 10 + .../getplaylistplaylistsresponsebody.md | 11 + .../sdkerrors/getplaylistresponsebody.md | 2 +- docs/models/sdkerrors/getplaylistserrors.md | 10 +- .../sdkerrors/getplaylistsplaylistserrors.md | 10 + .../getplaylistsplaylistsresponsebody.md | 11 + .../sdkerrors/getplaylistsresponsebody.md | 2 +- .../sdkerrors/getrecentlyaddederrors.md | 10 +- .../getrecentlyaddedlibraryerrors.md | 10 + .../getrecentlyaddedlibraryresponsebody.md | 11 + .../sdkerrors/getrecentlyaddedresponsebody.md | 2 +- .../getrefreshlibrarymetadataerrors.md | 10 + .../getrefreshlibrarymetadatalibraryerrors.md | 10 + ...freshlibrarymetadatalibraryresponsebody.md | 11 + .../getrefreshlibrarymetadataresponsebody.md | 11 + .../models/sdkerrors/getresizedphotoerrors.md | 10 +- .../sdkerrors/getresizedphotoresponsebody.md | 2 +- .../sdkerrors/getresizedphotoservererrors.md | 10 + .../getresizedphotoserverresponsebody.md | 11 + .../sdkerrors/getresourcesstatisticserrors.md | 10 +- .../getresourcesstatisticsresponsebody.md | 2 +- .../getresourcesstatisticsstatisticserrors.md | 10 + ...sourcesstatisticsstatisticsresponsebody.md | 11 + .../sdkerrors/getsearchlibraryerrors.md | 10 + .../getsearchlibrarylibraryerrors.md | 10 + .../getsearchlibrarylibraryresponsebody.md | 11 + .../sdkerrors/getsearchlibraryresponsebody.md | 11 + .../sdkerrors/getsearchresultserrors.md | 10 +- .../sdkerrors/getsearchresultsresponsebody.md | 2 +- .../sdkerrors/getsearchresultssearcherrors.md | 10 + .../getsearchresultssearchresponsebody.md | 11 + .../getserveractivitiesactivitieserrors.md | 10 + ...tserveractivitiesactivitiesresponsebody.md | 11 + .../sdkerrors/getserveractivitieserrors.md | 10 +- .../getserveractivitiesresponsebody.md | 2 +- .../sdkerrors/getservercapabilitieserrors.md | 10 + .../getservercapabilitiesresponsebody.md | 2 +- ...getservercapabilitiesserverresponsebody.md | 11 + .../getserveridentityresponsebody.md | 11 +- docs/models/sdkerrors/getserverlisterrors.md | 10 +- .../sdkerrors/getserverlistresponsebody.md | 2 +- .../sdkerrors/getserverlistservererrors.md | 10 + .../getserverlistserverresponsebody.md | 11 + .../sdkerrors/getserverpreferenceserrors.md | 10 +- .../getserverpreferencesresponsebody.md | 2 +- .../getserverpreferencesservererrors.md | 10 + .../getserverpreferencesserverresponsebody.md | 11 + .../sdkerrors/getserverresourceserrors.md | 10 + .../sdkerrors/getserverresourcesplexerrors.md | 10 + .../getserverresourcesplexresponsebody.md | 11 + .../getserverresourcesresponsebody.md | 11 + .../sdkerrors/getsessionhistoryerrors.md | 10 +- .../getsessionhistoryresponsebody.md | 2 +- .../getsessionhistorysessionserrors.md | 10 + .../getsessionhistorysessionsresponsebody.md | 11 + docs/models/sdkerrors/getsessionserrors.md | 10 +- .../sdkerrors/getsessionsresponsebody.md | 2 +- .../sdkerrors/getsessionssessionserrors.md | 10 + .../getsessionssessionsresponsebody.md | 11 + ...nnectioninformationauthenticationerrors.md | 10 + ...oninformationauthenticationresponsebody.md | 11 + .../getsourceconnectioninformationerrors.md | 10 +- ...sourceconnectioninformationresponsebody.md | 2 +- docs/models/sdkerrors/getstatisticserrors.md | 10 +- .../sdkerrors/getstatisticsresponsebody.md | 2 +- .../getstatisticsstatisticserrors.md | 10 + .../getstatisticsstatisticsresponsebody.md | 11 + docs/models/sdkerrors/getthumbimageerrors.md | 10 + .../sdkerrors/getthumbimagemediaerrors.md | 10 + .../getthumbimagemediaresponsebody.md | 11 + ...sebody.md => getthumbimageresponsebody.md} | 6 +- docs/models/sdkerrors/gettimelineerrors.md | 10 +- .../sdkerrors/gettimelineresponsebody.md | 2 +- .../sdkerrors/gettimelinevideoerrors.md | 10 + .../sdkerrors/gettimelinevideoresponsebody.md | 11 + .../models/sdkerrors/gettokenbypiniderrors.md | 10 + .../sdkerrors/gettokenbypinidplexerrors.md | 9 + .../gettokenbypinidplexresponsebody.md | 11 + .../sdkerrors/gettokenbypinidresponsebody.md | 11 + docs/models/sdkerrors/gettokenresponsebody.md | 11 - .../sdkerrors/gettopwatchedcontenterrors.md | 10 + .../gettopwatchedcontentlibraryerrors.md | 10 + ...gettopwatchedcontentlibraryresponsebody.md | 11 + .../gettopwatchedcontentresponsebody.md | 11 + .../sdkerrors/gettranscodesessionserrors.md | 10 +- .../gettranscodesessionsresponsebody.md | 2 +- .../gettranscodesessionssessionserrors.md | 10 + ...ettranscodesessionssessionsresponsebody.md | 11 + .../gettransienttokenauthenticationerrors.md | 10 + ...ransienttokenauthenticationresponsebody.md | 11 + .../sdkerrors/gettransienttokenerrors.md | 10 +- .../gettransienttokenresponsebody.md | 2 +- .../models/sdkerrors/getupdatestatuserrors.md | 10 +- .../sdkerrors/getupdatestatusresponsebody.md | 2 +- .../sdkerrors/getupdatestatusupdatererrors.md | 10 + .../getupdatestatusupdaterresponsebody.md | 11 + .../getuserdetailsauthenticationerrors.md | 10 + ...etuserdetailsauthenticationresponsebody.md | 11 + docs/models/sdkerrors/getuserdetailserrors.md | 10 + .../sdkerrors/getuserdetailsresponsebody.md | 11 + docs/models/sdkerrors/getuserfriendserrors.md | 10 + .../sdkerrors/getuserfriendsplexerrors.md | 10 + .../getuserfriendsplexresponsebody.md | 11 + .../sdkerrors/getuserfriendsresponsebody.md | 11 + docs/models/sdkerrors/getwatchlisterrors.md | 12 +- .../sdkerrors/getwatchlistresponsebody.md | 6 +- .../sdkerrors/getwatchlistwatchlisterrors.md | 10 + .../getwatchlistwatchlistresponsebody.md | 11 + docs/models/sdkerrors/loglineerrors.md | 10 +- ...etlibraryerrors.md => loglinelogerrors.md} | 6 +- ...ponsebody.md => loglinelogresponsebody.md} | 4 +- docs/models/sdkerrors/loglineresponsebody.md | 2 +- docs/models/sdkerrors/logmultilineerrors.md | 10 +- .../models/sdkerrors/logmultilinelogerrors.md | 10 + .../sdkerrors/logmultilinelogresponsebody.md | 11 + .../sdkerrors/logmultilineresponsebody.md | 2 +- docs/models/sdkerrors/markplayederrors.md | 10 +- .../models/sdkerrors/markplayedmediaerrors.md | 10 + .../sdkerrors/markplayedmediaresponsebody.md | 11 + .../sdkerrors/markplayedresponsebody.md | 2 +- docs/models/sdkerrors/markunplayederrors.md | 10 +- .../sdkerrors/markunplayedmediaerrors.md | 10 + .../markunplayedmediaresponsebody.md | 11 + .../sdkerrors/markunplayedresponsebody.md | 2 +- docs/models/sdkerrors/performsearcherrors.md | 10 +- .../sdkerrors/performsearchresponsebody.md | 2 +- .../sdkerrors/performsearchsearcherrors.md | 10 + .../performsearchsearchresponsebody.md | 11 + .../sdkerrors/performvoicesearcherrors.md | 10 +- .../performvoicesearchresponsebody.md | 2 +- .../performvoicesearchsearcherrors.md | 10 + .../performvoicesearchsearchresponsebody.md | 11 + ...postuserssignindataauthenticationerrors.md | 10 + ...erssignindataauthenticationresponsebody.md | 11 + .../sdkerrors/postuserssignindataerrors.md | 10 + .../postuserssignindataresponsebody.md | 11 + docs/models/sdkerrors/searchlibraryerrors.md | 10 - .../sdkerrors/startalltasksbutlererrors.md | 10 + .../startalltasksbutlerresponsebody.md | 11 + docs/models/sdkerrors/startalltaskserrors.md | 10 +- .../sdkerrors/startalltasksresponsebody.md | 2 +- .../models/sdkerrors/starttaskbutlererrors.md | 10 + .../sdkerrors/starttaskbutlerresponsebody.md | 11 + docs/models/sdkerrors/starttaskerrors.md | 10 +- .../models/sdkerrors/starttaskresponsebody.md | 2 +- .../startuniversaltranscodeerrors.md | 10 +- .../startuniversaltranscoderesponsebody.md | 2 +- .../startuniversaltranscodevideoerrors.md | 10 + ...tartuniversaltranscodevideoresponsebody.md | 11 + .../sdkerrors/stopalltasksbutlererrors.md | 10 + .../stopalltasksbutlerresponsebody.md | 11 + docs/models/sdkerrors/stopalltaskserrors.md | 10 +- .../sdkerrors/stopalltasksresponsebody.md | 2 +- ...adataerrors.md => stoptaskbutlererrors.md} | 6 +- .../sdkerrors/stoptaskbutlerresponsebody.md | 11 + docs/models/sdkerrors/stoptaskerrors.md | 10 +- docs/models/sdkerrors/stoptaskresponsebody.md | 2 +- .../sdkerrors/stoptranscodesessionerrors.md | 10 +- .../stoptranscodesessionresponsebody.md | 2 +- .../stoptranscodesessionsessionserrors.md | 10 + ...toptranscodesessionsessionsresponsebody.md | 11 + docs/models/sdkerrors/updateplaylisterrors.md | 10 +- .../updateplaylistplaylistserrors.md | 10 + .../updateplaylistplaylistsresponsebody.md | 11 + .../sdkerrors/updateplaylistresponsebody.md | 2 +- .../sdkerrors/updateplayprogresserrors.md | 10 +- .../updateplayprogressmediaerrors.md | 10 + .../updateplayprogressmediaresponsebody.md | 11 + .../updateplayprogressresponsebody.md | 2 +- docs/models/sdkerrors/uploadplaylisterrors.md | 10 +- .../uploadplaylistplaylistserrors.md | 10 + .../uploadplaylistplaylistsresponsebody.md | 11 + .../sdkerrors/uploadplaylistresponsebody.md | 2 +- docs/sdks/activities/README.md | 51 +- docs/sdks/authentication/README.md | 164 +- docs/sdks/butler/README.md | 114 +- docs/sdks/hubs/README.md | 45 +- docs/sdks/library/README.md | 370 +- docs/sdks/log/README.md | 80 +- docs/sdks/media/README.md | 198 +- docs/sdks/playlists/README.md | 252 +- docs/sdks/plex/README.md | 293 +- docs/sdks/plexapi/README.md | 6 +- docs/sdks/search/README.md | 74 +- docs/sdks/server/README.md | 239 +- docs/sdks/sessions/README.md | 103 +- docs/sdks/statistics/README.md | 62 +- docs/sdks/updater/README.md | 70 +- docs/sdks/video/README.md | 53 +- docs/sdks/watchlist/README.md | 37 +- hubs.go | 385 +- internal/globals/globals.go | 4 +- internal/hooks/hooks.go | 2 +- internal/utils/contenttype.go | 2 +- internal/utils/form.go | 2 +- internal/utils/headers.go | 2 +- internal/utils/json.go | 39 +- internal/utils/pathparams.go | 2 +- internal/utils/queryparams.go | 138 +- internal/utils/requestbody.go | 29 +- internal/utils/retries.go | 23 +- internal/utils/security.go | 19 +- internal/utils/utils.go | 2 +- library.go | 2366 ++++++++++-- log.go | 550 ++- media.go | 1026 +++++- models/components/security.go | 8 +- models/operations/addplaylistcontents.go | 2 +- models/operations/applyupdates.go | 6 +- models/operations/cancelserveractivities.go | 2 +- models/operations/checkforupdates.go | 2 +- models/operations/clearplaylistcontents.go | 2 +- models/operations/createplaylist.go | 26 +- models/operations/deletelibrary.go | 14 +- models/operations/deleteplaylist.go | 2 +- models/operations/enablepapertrail.go | 2 +- models/operations/getalllibraries.go | 286 ++ models/operations/getavailableclients.go | 2 +- models/operations/getbandwidthstatistics.go | 2 +- models/operations/getbannerimage.go | 109 + models/operations/getbutlertasks.go | 2 +- models/operations/getcompanionsdata.go | 102 + models/operations/getdevices.go | 2 +- models/operations/getfilehash.go | 2 +- models/operations/getgeodata.go | 165 + models/operations/getglobalhubs.go | 2 +- models/operations/gethomedata.go | 2 +- models/operations/getlibraries.go | 283 -- .../{getlibrary.go => getlibrarydetails.go} | 158 +- models/operations/getlibraryhubs.go | 2 +- models/operations/getlibraryitems.go | 172 +- models/operations/getmediaproviders.go | 661 ++++ ...tmetadata.go => getmetadatabyratingkey.go} | 354 +- models/operations/getmetadatachildren.go | 2 +- models/operations/getmyplexaccount.go | 2 +- models/operations/getondeck.go | 2 +- models/operations/getpin.go | 309 +- models/operations/getplaylist.go | 2 +- models/operations/getplaylistcontents.go | 56 +- models/operations/getplaylists.go | 2 +- models/operations/getrecentlyadded.go | 40 +- .../operations/getrefreshlibrarymetadata.go | 89 + models/operations/getresizedphoto.go | 2 +- models/operations/getresourcesstatistics.go | 2 +- models/operations/getsearchlibrary.go | 397 +++ models/operations/getsearchresults.go | 2 +- models/operations/getserveractivities.go | 2 +- models/operations/getservercapabilities.go | 2 +- models/operations/getserveridentity.go | 2 +- models/operations/getserverlist.go | 2 +- models/operations/getserverpreferences.go | 2 +- models/operations/getserverresources.go | 481 +++ models/operations/getsessionhistory.go | 10 +- models/operations/getsessions.go | 2 +- .../getsourceconnectioninformation.go | 2 +- models/operations/getstatistics.go | 2 +- models/operations/getthumbimage.go | 109 + models/operations/gettimeline.go | 2 +- models/operations/gettoken.go | 290 -- models/operations/gettokenbypinid.go | 319 ++ models/operations/gettopwatchedcontent.go | 56 +- models/operations/gettranscodesessions.go | 2 +- models/operations/gettransienttoken.go | 2 +- models/operations/getupdatestatus.go | 2 +- models/operations/getuserdetails.go | 1316 +++++++ models/operations/getuserfriends.go | 203 ++ models/operations/getwatchlist.go | 109 +- models/operations/logline.go | 2 +- models/operations/logmultiline.go | 2 +- models/operations/markplayed.go | 2 +- models/operations/markunplayed.go | 2 +- models/operations/options.go | 61 +- models/operations/performsearch.go | 2 +- models/operations/performvoicesearch.go | 2 +- models/operations/postuserssignindata.go | 1588 +++++++++ models/operations/refreshlibrary.go | 49 - models/operations/searchlibrary.go | 384 -- models/operations/startalltasks.go | 2 +- models/operations/starttask.go | 2 +- models/operations/startuniversaltranscode.go | 2 +- models/operations/stopalltasks.go | 2 +- models/operations/stoptask.go | 2 +- models/operations/stoptranscodesession.go | 2 +- models/operations/updateplaylist.go | 2 +- models/operations/updateplayprogress.go | 2 +- models/operations/uploadplaylist.go | 24 +- models/sdkerrors/addplaylistcontents.go | 57 +- models/sdkerrors/applyupdates.go | 57 +- models/sdkerrors/cancelserveractivities.go | 57 +- models/sdkerrors/checkforupdates.go | 57 +- models/sdkerrors/clearplaylistcontents.go | 57 +- models/sdkerrors/createplaylist.go | 57 +- models/sdkerrors/deletelibrary.go | 57 +- models/sdkerrors/deleteplaylist.go | 57 +- models/sdkerrors/enablepapertrail.go | 57 +- models/sdkerrors/getalllibraries.go | 90 + models/sdkerrors/getavailableclients.go | 57 +- models/sdkerrors/getbandwidthstatistics.go | 57 +- models/sdkerrors/getbannerimage.go | 90 + models/sdkerrors/getbutlertasks.go | 57 +- models/sdkerrors/getcompanionsdata.go | 90 + models/sdkerrors/getdevices.go | 57 +- models/sdkerrors/getfilehash.go | 57 +- models/sdkerrors/getgeodata.go | 90 + models/sdkerrors/getglobalhubs.go | 57 +- models/sdkerrors/gethomedata.go | 57 +- models/sdkerrors/getlibraries.go | 49 - models/sdkerrors/getlibrary.go | 49 - models/sdkerrors/getlibrarydetails.go | 90 + models/sdkerrors/getlibraryhubs.go | 57 +- models/sdkerrors/getlibraryitems.go | 57 +- models/sdkerrors/getmediaproviders.go | 90 + models/sdkerrors/getmetadata.go | 49 - models/sdkerrors/getmetadatabyratingkey.go | 90 + models/sdkerrors/getmetadatachildren.go | 57 +- models/sdkerrors/getmyplexaccount.go | 57 +- models/sdkerrors/getondeck.go | 57 +- models/sdkerrors/getpin.go | 14 +- models/sdkerrors/getplaylist.go | 57 +- models/sdkerrors/getplaylistcontents.go | 57 +- models/sdkerrors/getplaylists.go | 57 +- models/sdkerrors/getrecentlyadded.go | 57 +- models/sdkerrors/getrefreshlibrarymetadata.go | 90 + models/sdkerrors/getresizedphoto.go | 57 +- models/sdkerrors/getresourcesstatistics.go | 57 +- models/sdkerrors/getsearchlibrary.go | 90 + models/sdkerrors/getsearchresults.go | 57 +- models/sdkerrors/getserveractivities.go | 57 +- models/sdkerrors/getservercapabilities.go | 57 +- models/sdkerrors/getserveridentity.go | 42 +- models/sdkerrors/getserverlist.go | 57 +- models/sdkerrors/getserverpreferences.go | 57 +- models/sdkerrors/getserverresources.go | 90 + models/sdkerrors/getsessionhistory.go | 57 +- models/sdkerrors/getsessions.go | 57 +- .../getsourceconnectioninformation.go | 57 +- models/sdkerrors/getstatistics.go | 57 +- models/sdkerrors/getthumbimage.go | 90 + models/sdkerrors/gettimeline.go | 57 +- models/sdkerrors/gettoken.go | 49 - models/sdkerrors/gettokenbypinid.go | 82 + models/sdkerrors/gettopwatchedcontent.go | 90 + models/sdkerrors/gettranscodesessions.go | 57 +- models/sdkerrors/gettransienttoken.go | 57 +- models/sdkerrors/getupdatestatus.go | 57 +- models/sdkerrors/getuserdetails.go | 90 + models/sdkerrors/getuserfriends.go | 90 + models/sdkerrors/getwatchlist.go | 67 +- models/sdkerrors/logline.go | 57 +- models/sdkerrors/logmultiline.go | 57 +- models/sdkerrors/markplayed.go | 57 +- models/sdkerrors/markunplayed.go | 57 +- models/sdkerrors/performsearch.go | 57 +- models/sdkerrors/performvoicesearch.go | 57 +- models/sdkerrors/postuserssignindata.go | 90 + models/sdkerrors/refreshlibrary.go | 49 - models/sdkerrors/sdkerror.go | 2 +- models/sdkerrors/searchlibrary.go | 49 - models/sdkerrors/startalltasks.go | 57 +- models/sdkerrors/starttask.go | 57 +- models/sdkerrors/startuniversaltranscode.go | 57 +- models/sdkerrors/stopalltasks.go | 57 +- models/sdkerrors/stoptask.go | 57 +- models/sdkerrors/stoptranscodesession.go | 57 +- models/sdkerrors/updateplaylist.go | 57 +- models/sdkerrors/updateplayprogress.go | 57 +- models/sdkerrors/uploadplaylist.go | 57 +- playlists.go | 1682 +++++++-- plex.go | 1545 +++++++- plexapi.go | 39 +- retry/config.go | 16 + search.go | 556 ++- server.go | 1762 +++++++-- sessions.go | 757 +++- statistics.go | 576 ++- types/bigint.go | 2 +- types/date.go | 2 +- types/datetime.go | 2 +- types/decimal.go | 2 +- types/pointers.go | 2 +- updater.go | 560 ++- video.go | 365 +- watchlist.go | 197 +- 678 files changed, 32760 insertions(+), 8167 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 docs/models/operations/autoselectsubtitle.md create mode 100644 docs/models/operations/billing.md create mode 100644 docs/models/operations/connections.md create mode 100644 docs/models/operations/createplaylistqueryparamtype.md create mode 100644 docs/models/operations/defaultsubtitleaccessibility.md create mode 100644 docs/models/operations/defaultsubtitleforced.md create mode 100644 docs/models/operations/feature.md create mode 100644 docs/models/operations/features.md create mode 100644 docs/models/operations/friend.md create mode 100644 docs/models/operations/geodata.md create mode 100644 docs/models/operations/getalllibrariesdirectory.md create mode 100644 docs/models/operations/getalllibrariesmediacontainer.md create mode 100644 docs/models/operations/getalllibrariesresponse.md create mode 100644 docs/models/operations/getalllibrariesresponsebody.md create mode 100644 docs/models/operations/getbannerimagerequest.md create mode 100644 docs/models/operations/getbannerimageresponse.md create mode 100644 docs/models/operations/getcompanionsdataresponse.md create mode 100644 docs/models/operations/getgeodatageodata.md rename docs/models/operations/{getpinresponsebody.md => getgeodataresponse.md} (57%) delete mode 100644 docs/models/operations/getlibrariesdirectory.md delete mode 100644 docs/models/operations/getlibrarieslocation.md delete mode 100644 docs/models/operations/getlibrariesmediacontainer.md delete mode 100644 docs/models/operations/getlibrariesresponse.md delete mode 100644 docs/models/operations/getlibrariesresponsebody.md rename docs/models/operations/{getlibrarydirectory.md => getlibrarydetailsdirectory.md} (96%) rename docs/models/operations/{getlibraryfilter.md => getlibrarydetailsfilter.md} (97%) create mode 100644 docs/models/operations/getlibrarydetailsmediacontainer.md rename docs/models/operations/{getlibraryrequest.md => getlibrarydetailsrequest.md} (89%) create mode 100644 docs/models/operations/getlibrarydetailsresponse.md create mode 100644 docs/models/operations/getlibrarydetailsresponsebody.md create mode 100644 docs/models/operations/getlibrarydetailstype.md delete mode 100644 docs/models/operations/getlibrarymediacontainer.md delete mode 100644 docs/models/operations/getlibraryresponse.md delete mode 100644 docs/models/operations/getlibraryresponsebody.md delete mode 100644 docs/models/operations/getlibrarytype.md create mode 100644 docs/models/operations/getmediaprovidersdirectory.md create mode 100644 docs/models/operations/getmediaprovidersmediacontainer.md create mode 100644 docs/models/operations/getmediaprovidersrequest.md create mode 100644 docs/models/operations/getmediaprovidersresponse.md create mode 100644 docs/models/operations/getmediaprovidersresponsebody.md rename docs/models/operations/{getmetadatacountry.md => getmetadatabyratingkeycountry.md} (95%) rename docs/models/operations/{getmetadatadirector.md => getmetadatabyratingkeydirector.md} (98%) rename docs/models/operations/{getmetadatagenre.md => getmetadatabyratingkeygenre.md} (94%) create mode 100644 docs/models/operations/getmetadatabyratingkeymedia.md create mode 100644 docs/models/operations/getmetadatabyratingkeymediacontainer.md rename docs/models/operations/{getmetadatametadata.md => getmetadatabyratingkeymetadata.md} (98%) rename docs/models/operations/{getmetadatapart.md => getmetadatabyratingkeypart.md} (99%) rename docs/models/operations/{getmetadatarequest.md => getmetadatabyratingkeyrequest.md} (51%) create mode 100644 docs/models/operations/getmetadatabyratingkeyresponse.md create mode 100644 docs/models/operations/getmetadatabyratingkeyresponsebody.md rename docs/models/operations/{getmetadatarole.md => getmetadatabyratingkeyrole.md} (99%) rename docs/models/operations/{getmetadatawriter.md => getmetadatabyratingkeywriter.md} (98%) delete mode 100644 docs/models/operations/getmetadatamedia.md delete mode 100644 docs/models/operations/getmetadatamediacontainer.md delete mode 100644 docs/models/operations/getmetadataresponse.md delete mode 100644 docs/models/operations/getmetadataresponsebody.md create mode 100644 docs/models/operations/getpinauthpincontainer.md create mode 100644 docs/models/operations/getplaylistcontentsqueryparamtype.md create mode 100644 docs/models/operations/getrecentlyaddedrequest.md create mode 100644 docs/models/operations/getrefreshlibrarymetadatarequest.md rename docs/models/operations/{refreshlibraryresponse.md => getrefreshlibrarymetadataresponse.md} (97%) create mode 100644 docs/models/operations/getsearchlibrarymediacontainer.md rename docs/models/operations/{searchlibrarymetadata.md => getsearchlibrarymetadata.md} (99%) create mode 100644 docs/models/operations/getsearchlibraryrequest.md create mode 100644 docs/models/operations/getsearchlibraryresponse.md create mode 100644 docs/models/operations/getsearchlibraryresponsebody.md create mode 100644 docs/models/operations/getserverresourcesglobals.md create mode 100644 docs/models/operations/getserverresourcesrequest.md create mode 100644 docs/models/operations/getserverresourcesresponse.md create mode 100644 docs/models/operations/getthumbimagerequest.md create mode 100644 docs/models/operations/getthumbimageresponse.md create mode 100644 docs/models/operations/gettokenbypinidauthpincontainer.md create mode 100644 docs/models/operations/gettokenbypinidgeodata.md rename docs/models/operations/{gettokenglobals.md => gettokenbypinidglobals.md} (94%) rename docs/models/operations/{gettokenrequest.md => gettokenbypinidrequest.md} (92%) create mode 100644 docs/models/operations/gettokenbypinidresponse.md delete mode 100644 docs/models/operations/gettokenlocation.md delete mode 100644 docs/models/operations/gettokenresponse.md delete mode 100644 docs/models/operations/gettokenresponsebody.md create mode 100644 docs/models/operations/gettopwatchedcontentqueryparamtype.md create mode 100644 docs/models/operations/getuserdetailsauthenticationresponsestatus.md create mode 100644 docs/models/operations/getuserdetailsauthenticationstatus.md create mode 100644 docs/models/operations/getuserdetailsfeatures.md create mode 100644 docs/models/operations/getuserdetailsrequest.md create mode 100644 docs/models/operations/getuserdetailsresponse.md create mode 100644 docs/models/operations/getuserdetailsstatus.md create mode 100644 docs/models/operations/getuserdetailssubscription.md create mode 100644 docs/models/operations/getuserdetailsuserplexaccount.md create mode 100644 docs/models/operations/getuserfriendsresponse.md create mode 100644 docs/models/operations/includeguids.md create mode 100644 docs/models/operations/includehttps.md create mode 100644 docs/models/operations/includeipv6.md create mode 100644 docs/models/operations/includemeta.md create mode 100644 docs/models/operations/includerelay.md create mode 100644 docs/models/operations/internalpaymentmethod.md create mode 100644 docs/models/operations/mailingliststatus.md create mode 100644 docs/models/operations/mediaprovider.md create mode 100644 docs/models/operations/mediareviewsvisibility.md create mode 100644 docs/models/operations/pastsubscription.md delete mode 100644 docs/models/operations/pathparamfilter.md create mode 100644 docs/models/operations/pivot.md create mode 100644 docs/models/operations/plexdevice.md create mode 100644 docs/models/operations/postuserssignindataauthenticationfeatures.md create mode 100644 docs/models/operations/postuserssignindataauthenticationresponsestatus.md create mode 100644 docs/models/operations/postuserssignindataauthenticationstatus.md create mode 100644 docs/models/operations/postuserssignindataauthenticationsubscription.md create mode 100644 docs/models/operations/postuserssignindataautoselectsubtitle.md create mode 100644 docs/models/operations/postuserssignindatadefaultsubtitleaccessibility.md create mode 100644 docs/models/operations/postuserssignindatadefaultsubtitleforced.md create mode 100644 docs/models/operations/postuserssignindatafeatures.md create mode 100644 docs/models/operations/postuserssignindataglobals.md create mode 100644 docs/models/operations/postuserssignindatamailingliststatus.md create mode 100644 docs/models/operations/postuserssignindatamediareviewsvisibility.md create mode 100644 docs/models/operations/postuserssignindatarequest.md create mode 100644 docs/models/operations/postuserssignindatarequestbody.md create mode 100644 docs/models/operations/postuserssignindataresponse.md create mode 100644 docs/models/operations/postuserssignindataservices.md create mode 100644 docs/models/operations/postuserssignindatastate.md create mode 100644 docs/models/operations/postuserssignindatastatus.md create mode 100644 docs/models/operations/postuserssignindatasubscription.md create mode 100644 docs/models/operations/postuserssignindatauserplexaccount.md create mode 100644 docs/models/operations/postuserssignindatauserprofile.md create mode 100644 docs/models/operations/postuserssignindatawatchedindicator.md create mode 100644 docs/models/operations/queryparamfilter.md create mode 100644 docs/models/operations/queryparamforce.md delete mode 100644 docs/models/operations/refreshlibraryrequest.md create mode 100644 docs/models/operations/responsebody.md delete mode 100644 docs/models/operations/searchlibrarymediacontainer.md delete mode 100644 docs/models/operations/searchlibraryrequest.md delete mode 100644 docs/models/operations/searchlibraryresponse.md delete mode 100644 docs/models/operations/searchlibraryresponsebody.md create mode 100644 docs/models/operations/services.md create mode 100644 docs/models/operations/sharedservers.md create mode 100644 docs/models/operations/sharedsources.md create mode 100644 docs/models/operations/status.md create mode 100644 docs/models/operations/subscription.md create mode 100644 docs/models/operations/trials.md create mode 100644 docs/models/operations/userprofile.md create mode 100644 docs/models/operations/watchedindicator.md create mode 100644 docs/models/sdkerrors/addplaylistcontentsplaylistserrors.md create mode 100644 docs/models/sdkerrors/addplaylistcontentsplaylistsresponsebody.md create mode 100644 docs/models/sdkerrors/applyupdatesupdatererrors.md create mode 100644 docs/models/sdkerrors/applyupdatesupdaterresponsebody.md create mode 100644 docs/models/sdkerrors/cancelserveractivitiesactivitieserrors.md create mode 100644 docs/models/sdkerrors/cancelserveractivitiesactivitiesresponsebody.md create mode 100644 docs/models/sdkerrors/checkforupdatesupdatererrors.md create mode 100644 docs/models/sdkerrors/checkforupdatesupdaterresponsebody.md create mode 100644 docs/models/sdkerrors/clearplaylistcontentsplaylistserrors.md create mode 100644 docs/models/sdkerrors/clearplaylistcontentsplaylistsresponsebody.md create mode 100644 docs/models/sdkerrors/createplaylistplaylistserrors.md create mode 100644 docs/models/sdkerrors/createplaylistplaylistsresponsebody.md create mode 100644 docs/models/sdkerrors/deletelibrarylibraryerrors.md create mode 100644 docs/models/sdkerrors/deletelibrarylibraryresponsebody.md create mode 100644 docs/models/sdkerrors/deleteplaylistplaylistserrors.md create mode 100644 docs/models/sdkerrors/deleteplaylistplaylistsresponsebody.md create mode 100644 docs/models/sdkerrors/enablepapertraillogerrors.md create mode 100644 docs/models/sdkerrors/enablepapertraillogresponsebody.md create mode 100644 docs/models/sdkerrors/getalllibrarieserrors.md create mode 100644 docs/models/sdkerrors/getalllibrarieslibraryerrors.md create mode 100644 docs/models/sdkerrors/getalllibrarieslibraryresponsebody.md create mode 100644 docs/models/sdkerrors/getalllibrariesresponsebody.md create mode 100644 docs/models/sdkerrors/getavailableclientsservererrors.md create mode 100644 docs/models/sdkerrors/getavailableclientsserverresponsebody.md create mode 100644 docs/models/sdkerrors/getbandwidthstatisticsstatisticserrors.md create mode 100644 docs/models/sdkerrors/getbandwidthstatisticsstatisticsresponsebody.md create mode 100644 docs/models/sdkerrors/getbannerimageerrors.md create mode 100644 docs/models/sdkerrors/getbannerimagemediaerrors.md create mode 100644 docs/models/sdkerrors/getbannerimagemediaresponsebody.md create mode 100644 docs/models/sdkerrors/getbannerimageresponsebody.md create mode 100644 docs/models/sdkerrors/getbutlertasksbutlererrors.md create mode 100644 docs/models/sdkerrors/getbutlertasksbutlerresponsebody.md create mode 100644 docs/models/sdkerrors/getcompanionsdataerrors.md create mode 100644 docs/models/sdkerrors/getcompanionsdataplexerrors.md create mode 100644 docs/models/sdkerrors/getcompanionsdataplexresponsebody.md create mode 100644 docs/models/sdkerrors/getcompanionsdataresponsebody.md create mode 100644 docs/models/sdkerrors/getdevicesservererrors.md create mode 100644 docs/models/sdkerrors/getdevicesserverresponsebody.md create mode 100644 docs/models/sdkerrors/getfilehashlibraryerrors.md create mode 100644 docs/models/sdkerrors/getfilehashlibraryresponsebody.md rename docs/models/sdkerrors/{gettokenerrors.md => getgeodataerrors.md} (85%) rename docs/models/sdkerrors/{getlibrarieserrors.md => getgeodataplexerrors.md} (83%) rename docs/models/sdkerrors/{refreshlibraryresponsebody.md => getgeodataplexresponsebody.md} (89%) create mode 100644 docs/models/sdkerrors/getgeodataresponsebody.md rename docs/models/sdkerrors/{getserveridentityerrors.md => getglobalhubshubserrors.md} (82%) create mode 100644 docs/models/sdkerrors/getglobalhubshubsresponsebody.md rename docs/models/sdkerrors/{refreshlibraryerrors.md => gethomedataplexerrors.md} (83%) create mode 100644 docs/models/sdkerrors/gethomedataplexresponsebody.md delete mode 100644 docs/models/sdkerrors/getlibrariesresponsebody.md create mode 100644 docs/models/sdkerrors/getlibrarydetailserrors.md create mode 100644 docs/models/sdkerrors/getlibrarydetailslibraryerrors.md create mode 100644 docs/models/sdkerrors/getlibrarydetailslibraryresponsebody.md create mode 100644 docs/models/sdkerrors/getlibrarydetailsresponsebody.md create mode 100644 docs/models/sdkerrors/getlibraryhubshubserrors.md create mode 100644 docs/models/sdkerrors/getlibraryhubshubsresponsebody.md create mode 100644 docs/models/sdkerrors/getlibraryitemslibraryerrors.md create mode 100644 docs/models/sdkerrors/getlibraryitemslibraryresponsebody.md create mode 100644 docs/models/sdkerrors/getmediaproviderserrors.md create mode 100644 docs/models/sdkerrors/getmediaprovidersresponsebody.md create mode 100644 docs/models/sdkerrors/getmediaprovidersservererrors.md create mode 100644 docs/models/sdkerrors/getmediaprovidersserverresponsebody.md create mode 100644 docs/models/sdkerrors/getmetadatabyratingkeyerrors.md create mode 100644 docs/models/sdkerrors/getmetadatabyratingkeylibraryerrors.md create mode 100644 docs/models/sdkerrors/getmetadatabyratingkeylibraryresponsebody.md create mode 100644 docs/models/sdkerrors/getmetadatabyratingkeyresponsebody.md create mode 100644 docs/models/sdkerrors/getmetadatachildrenlibraryerrors.md create mode 100644 docs/models/sdkerrors/getmetadatachildrenlibraryresponsebody.md delete mode 100644 docs/models/sdkerrors/getmetadataresponsebody.md create mode 100644 docs/models/sdkerrors/getmyplexaccountservererrors.md create mode 100644 docs/models/sdkerrors/getmyplexaccountserverresponsebody.md create mode 100644 docs/models/sdkerrors/getondecklibraryerrors.md create mode 100644 docs/models/sdkerrors/getondecklibraryresponsebody.md create mode 100644 docs/models/sdkerrors/getplaylistcontentsplaylistserrors.md create mode 100644 docs/models/sdkerrors/getplaylistcontentsplaylistsresponsebody.md create mode 100644 docs/models/sdkerrors/getplaylistplaylistserrors.md create mode 100644 docs/models/sdkerrors/getplaylistplaylistsresponsebody.md create mode 100644 docs/models/sdkerrors/getplaylistsplaylistserrors.md create mode 100644 docs/models/sdkerrors/getplaylistsplaylistsresponsebody.md create mode 100644 docs/models/sdkerrors/getrecentlyaddedlibraryerrors.md create mode 100644 docs/models/sdkerrors/getrecentlyaddedlibraryresponsebody.md create mode 100644 docs/models/sdkerrors/getrefreshlibrarymetadataerrors.md create mode 100644 docs/models/sdkerrors/getrefreshlibrarymetadatalibraryerrors.md create mode 100644 docs/models/sdkerrors/getrefreshlibrarymetadatalibraryresponsebody.md create mode 100644 docs/models/sdkerrors/getrefreshlibrarymetadataresponsebody.md create mode 100644 docs/models/sdkerrors/getresizedphotoservererrors.md create mode 100644 docs/models/sdkerrors/getresizedphotoserverresponsebody.md create mode 100644 docs/models/sdkerrors/getresourcesstatisticsstatisticserrors.md create mode 100644 docs/models/sdkerrors/getresourcesstatisticsstatisticsresponsebody.md create mode 100644 docs/models/sdkerrors/getsearchlibraryerrors.md create mode 100644 docs/models/sdkerrors/getsearchlibrarylibraryerrors.md create mode 100644 docs/models/sdkerrors/getsearchlibrarylibraryresponsebody.md create mode 100644 docs/models/sdkerrors/getsearchlibraryresponsebody.md create mode 100644 docs/models/sdkerrors/getsearchresultssearcherrors.md create mode 100644 docs/models/sdkerrors/getsearchresultssearchresponsebody.md create mode 100644 docs/models/sdkerrors/getserveractivitiesactivitieserrors.md create mode 100644 docs/models/sdkerrors/getserveractivitiesactivitiesresponsebody.md create mode 100644 docs/models/sdkerrors/getservercapabilitieserrors.md create mode 100644 docs/models/sdkerrors/getservercapabilitiesserverresponsebody.md create mode 100644 docs/models/sdkerrors/getserverlistservererrors.md create mode 100644 docs/models/sdkerrors/getserverlistserverresponsebody.md create mode 100644 docs/models/sdkerrors/getserverpreferencesservererrors.md create mode 100644 docs/models/sdkerrors/getserverpreferencesserverresponsebody.md create mode 100644 docs/models/sdkerrors/getserverresourceserrors.md create mode 100644 docs/models/sdkerrors/getserverresourcesplexerrors.md create mode 100644 docs/models/sdkerrors/getserverresourcesplexresponsebody.md create mode 100644 docs/models/sdkerrors/getserverresourcesresponsebody.md create mode 100644 docs/models/sdkerrors/getsessionhistorysessionserrors.md create mode 100644 docs/models/sdkerrors/getsessionhistorysessionsresponsebody.md create mode 100644 docs/models/sdkerrors/getsessionssessionserrors.md create mode 100644 docs/models/sdkerrors/getsessionssessionsresponsebody.md create mode 100644 docs/models/sdkerrors/getsourceconnectioninformationauthenticationerrors.md create mode 100644 docs/models/sdkerrors/getsourceconnectioninformationauthenticationresponsebody.md create mode 100644 docs/models/sdkerrors/getstatisticsstatisticserrors.md create mode 100644 docs/models/sdkerrors/getstatisticsstatisticsresponsebody.md create mode 100644 docs/models/sdkerrors/getthumbimageerrors.md create mode 100644 docs/models/sdkerrors/getthumbimagemediaerrors.md create mode 100644 docs/models/sdkerrors/getthumbimagemediaresponsebody.md rename docs/models/sdkerrors/{searchlibraryresponsebody.md => getthumbimageresponsebody.md} (83%) create mode 100644 docs/models/sdkerrors/gettimelinevideoerrors.md create mode 100644 docs/models/sdkerrors/gettimelinevideoresponsebody.md create mode 100644 docs/models/sdkerrors/gettokenbypiniderrors.md create mode 100644 docs/models/sdkerrors/gettokenbypinidplexerrors.md create mode 100644 docs/models/sdkerrors/gettokenbypinidplexresponsebody.md create mode 100644 docs/models/sdkerrors/gettokenbypinidresponsebody.md delete mode 100644 docs/models/sdkerrors/gettokenresponsebody.md create mode 100644 docs/models/sdkerrors/gettopwatchedcontenterrors.md create mode 100644 docs/models/sdkerrors/gettopwatchedcontentlibraryerrors.md create mode 100644 docs/models/sdkerrors/gettopwatchedcontentlibraryresponsebody.md create mode 100644 docs/models/sdkerrors/gettopwatchedcontentresponsebody.md create mode 100644 docs/models/sdkerrors/gettranscodesessionssessionserrors.md create mode 100644 docs/models/sdkerrors/gettranscodesessionssessionsresponsebody.md create mode 100644 docs/models/sdkerrors/gettransienttokenauthenticationerrors.md create mode 100644 docs/models/sdkerrors/gettransienttokenauthenticationresponsebody.md create mode 100644 docs/models/sdkerrors/getupdatestatusupdatererrors.md create mode 100644 docs/models/sdkerrors/getupdatestatusupdaterresponsebody.md create mode 100644 docs/models/sdkerrors/getuserdetailsauthenticationerrors.md create mode 100644 docs/models/sdkerrors/getuserdetailsauthenticationresponsebody.md create mode 100644 docs/models/sdkerrors/getuserdetailserrors.md create mode 100644 docs/models/sdkerrors/getuserdetailsresponsebody.md create mode 100644 docs/models/sdkerrors/getuserfriendserrors.md create mode 100644 docs/models/sdkerrors/getuserfriendsplexerrors.md create mode 100644 docs/models/sdkerrors/getuserfriendsplexresponsebody.md create mode 100644 docs/models/sdkerrors/getuserfriendsresponsebody.md create mode 100644 docs/models/sdkerrors/getwatchlistwatchlisterrors.md create mode 100644 docs/models/sdkerrors/getwatchlistwatchlistresponsebody.md rename docs/models/sdkerrors/{getlibraryerrors.md => loglinelogerrors.md} (83%) rename docs/models/sdkerrors/{getlibraryresponsebody.md => loglinelogresponsebody.md} (88%) create mode 100644 docs/models/sdkerrors/logmultilinelogerrors.md create mode 100644 docs/models/sdkerrors/logmultilinelogresponsebody.md create mode 100644 docs/models/sdkerrors/markplayedmediaerrors.md create mode 100644 docs/models/sdkerrors/markplayedmediaresponsebody.md create mode 100644 docs/models/sdkerrors/markunplayedmediaerrors.md create mode 100644 docs/models/sdkerrors/markunplayedmediaresponsebody.md create mode 100644 docs/models/sdkerrors/performsearchsearcherrors.md create mode 100644 docs/models/sdkerrors/performsearchsearchresponsebody.md create mode 100644 docs/models/sdkerrors/performvoicesearchsearcherrors.md create mode 100644 docs/models/sdkerrors/performvoicesearchsearchresponsebody.md create mode 100644 docs/models/sdkerrors/postuserssignindataauthenticationerrors.md create mode 100644 docs/models/sdkerrors/postuserssignindataauthenticationresponsebody.md create mode 100644 docs/models/sdkerrors/postuserssignindataerrors.md create mode 100644 docs/models/sdkerrors/postuserssignindataresponsebody.md delete mode 100644 docs/models/sdkerrors/searchlibraryerrors.md create mode 100644 docs/models/sdkerrors/startalltasksbutlererrors.md create mode 100644 docs/models/sdkerrors/startalltasksbutlerresponsebody.md create mode 100644 docs/models/sdkerrors/starttaskbutlererrors.md create mode 100644 docs/models/sdkerrors/starttaskbutlerresponsebody.md create mode 100644 docs/models/sdkerrors/startuniversaltranscodevideoerrors.md create mode 100644 docs/models/sdkerrors/startuniversaltranscodevideoresponsebody.md create mode 100644 docs/models/sdkerrors/stopalltasksbutlererrors.md create mode 100644 docs/models/sdkerrors/stopalltasksbutlerresponsebody.md rename docs/models/sdkerrors/{getmetadataerrors.md => stoptaskbutlererrors.md} (83%) create mode 100644 docs/models/sdkerrors/stoptaskbutlerresponsebody.md create mode 100644 docs/models/sdkerrors/stoptranscodesessionsessionserrors.md create mode 100644 docs/models/sdkerrors/stoptranscodesessionsessionsresponsebody.md create mode 100644 docs/models/sdkerrors/updateplaylistplaylistserrors.md create mode 100644 docs/models/sdkerrors/updateplaylistplaylistsresponsebody.md create mode 100644 docs/models/sdkerrors/updateplayprogressmediaerrors.md create mode 100644 docs/models/sdkerrors/updateplayprogressmediaresponsebody.md create mode 100644 docs/models/sdkerrors/uploadplaylistplaylistserrors.md create mode 100644 docs/models/sdkerrors/uploadplaylistplaylistsresponsebody.md create mode 100644 models/operations/getalllibraries.go create mode 100644 models/operations/getbannerimage.go create mode 100644 models/operations/getcompanionsdata.go create mode 100644 models/operations/getgeodata.go delete mode 100644 models/operations/getlibraries.go rename models/operations/{getlibrary.go => getlibrarydetails.go} (55%) create mode 100644 models/operations/getmediaproviders.go rename models/operations/{getmetadata.go => getmetadatabyratingkey.go} (52%) create mode 100644 models/operations/getrefreshlibrarymetadata.go create mode 100644 models/operations/getsearchlibrary.go create mode 100644 models/operations/getserverresources.go create mode 100644 models/operations/getthumbimage.go delete mode 100644 models/operations/gettoken.go create mode 100644 models/operations/gettokenbypinid.go create mode 100644 models/operations/getuserdetails.go create mode 100644 models/operations/getuserfriends.go create mode 100644 models/operations/postuserssignindata.go delete mode 100644 models/operations/refreshlibrary.go delete mode 100644 models/operations/searchlibrary.go create mode 100644 models/sdkerrors/getalllibraries.go create mode 100644 models/sdkerrors/getbannerimage.go create mode 100644 models/sdkerrors/getcompanionsdata.go create mode 100644 models/sdkerrors/getgeodata.go delete mode 100644 models/sdkerrors/getlibraries.go delete mode 100644 models/sdkerrors/getlibrary.go create mode 100644 models/sdkerrors/getlibrarydetails.go create mode 100644 models/sdkerrors/getmediaproviders.go delete mode 100644 models/sdkerrors/getmetadata.go create mode 100644 models/sdkerrors/getmetadatabyratingkey.go create mode 100644 models/sdkerrors/getrefreshlibrarymetadata.go create mode 100644 models/sdkerrors/getsearchlibrary.go create mode 100644 models/sdkerrors/getserverresources.go create mode 100644 models/sdkerrors/getthumbimage.go delete mode 100644 models/sdkerrors/gettoken.go create mode 100644 models/sdkerrors/gettokenbypinid.go create mode 100644 models/sdkerrors/gettopwatchedcontent.go create mode 100644 models/sdkerrors/getuserdetails.go create mode 100644 models/sdkerrors/getuserfriends.go create mode 100644 models/sdkerrors/postuserssignindata.go delete mode 100644 models/sdkerrors/refreshlibrary.go delete mode 100644 models/sdkerrors/searchlibrary.go create mode 100644 retry/config.go diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 81f5eb4..4070848 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: e73920abd3a55e8d249592f2e3090574 + docChecksum: 06023774169418572a5ebabe14a70f3f docVersion: 0.0.3 - speakeasyVersion: 1.323.0 - generationVersion: 2.356.0 - releaseVersion: 0.10.1 - configChecksum: 513d92bc28d06bf5f85b74de4e501cc1 + speakeasyVersion: 1.393.0 + generationVersion: 2.413.0 + releaseVersion: 0.11.0 + configChecksum: a52d75eabaa4aca024abe40b1a5ceb64 repoURL: https://github.com/LukeHagar/plexgo.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/plexgo @@ -14,10 +14,15 @@ management: features: go: additionalDependencies: 0.1.0 - constsAndDefaults: 0.1.4 - core: 3.4.14 + constsAndDefaults: 0.1.6 + core: 3.5.6 + defaultEnabledRetries: 0.2.0 + deprecations: 2.81.1 + downloadStreams: 0.1.2 + envVarSecurityUsage: 0.3.1 + errors: 2.81.9 flattening: 2.81.1 - globalSecurity: 2.82.9 + globalSecurity: 2.82.10 globalSecurityCallbacks: 0.1.0 globalSecurityFlattening: 0.1.0 globalServerURLs: 2.82.2 @@ -27,34 +32,880 @@ features: nameOverrides: 2.81.2 nullables: 0.1.0 responseFormat: 0.1.2 + retries: 2.83.0 sdkHooks: 0.1.0 - typeOverrides: 2.81.1 - unions: 2.85.8 + unions: 2.85.9 generatedFiles: - - server.go - - media.go - - video.go + - .gitattributes + - /models/components/security.go + - /models/operations/addplaylistcontents.go + - /models/operations/applyupdates.go + - /models/operations/cancelserveractivities.go + - /models/operations/checkforupdates.go + - /models/operations/clearplaylistcontents.go + - /models/operations/createplaylist.go + - /models/operations/deletelibrary.go + - /models/operations/deleteplaylist.go + - /models/operations/enablepapertrail.go + - /models/operations/getalllibraries.go + - /models/operations/getavailableclients.go + - /models/operations/getbandwidthstatistics.go + - /models/operations/getbannerimage.go + - /models/operations/getbutlertasks.go + - /models/operations/getcompanionsdata.go + - /models/operations/getdevices.go + - /models/operations/getfilehash.go + - /models/operations/getgeodata.go + - /models/operations/getglobalhubs.go + - /models/operations/gethomedata.go + - /models/operations/getlibrarydetails.go + - /models/operations/getlibraryhubs.go + - /models/operations/getlibraryitems.go + - /models/operations/getmediaproviders.go + - /models/operations/getmetadatabyratingkey.go + - /models/operations/getmetadatachildren.go + - /models/operations/getmyplexaccount.go + - /models/operations/getondeck.go + - /models/operations/getpin.go + - /models/operations/getplaylist.go + - /models/operations/getplaylistcontents.go + - /models/operations/getplaylists.go + - /models/operations/getrecentlyadded.go + - /models/operations/getrefreshlibrarymetadata.go + - /models/operations/getresizedphoto.go + - /models/operations/getresourcesstatistics.go + - /models/operations/getsearchlibrary.go + - /models/operations/getsearchresults.go + - /models/operations/getserveractivities.go + - /models/operations/getservercapabilities.go + - /models/operations/getserveridentity.go + - /models/operations/getserverlist.go + - /models/operations/getserverpreferences.go + - /models/operations/getserverresources.go + - /models/operations/getsessionhistory.go + - /models/operations/getsessions.go + - /models/operations/getsourceconnectioninformation.go + - /models/operations/getstatistics.go + - /models/operations/getthumbimage.go + - /models/operations/gettimeline.go + - /models/operations/gettokenbypinid.go + - /models/operations/gettopwatchedcontent.go + - /models/operations/gettranscodesessions.go + - /models/operations/gettransienttoken.go + - /models/operations/getupdatestatus.go + - /models/operations/getuserdetails.go + - /models/operations/getuserfriends.go + - /models/operations/getwatchlist.go + - /models/operations/logline.go + - /models/operations/logmultiline.go + - /models/operations/markplayed.go + - /models/operations/markunplayed.go + - /models/operations/performsearch.go + - /models/operations/performvoicesearch.go + - /models/operations/postuserssignindata.go + - /models/operations/startalltasks.go + - /models/operations/starttask.go + - /models/operations/startuniversaltranscode.go + - /models/operations/stopalltasks.go + - /models/operations/stoptask.go + - /models/operations/stoptranscodesession.go + - /models/operations/updateplaylist.go + - /models/operations/updateplayprogress.go + - /models/operations/uploadplaylist.go + - /models/sdkerrors/addplaylistcontents.go + - /models/sdkerrors/applyupdates.go + - /models/sdkerrors/cancelserveractivities.go + - /models/sdkerrors/checkforupdates.go + - /models/sdkerrors/clearplaylistcontents.go + - /models/sdkerrors/createplaylist.go + - /models/sdkerrors/deletelibrary.go + - /models/sdkerrors/deleteplaylist.go + - /models/sdkerrors/enablepapertrail.go + - /models/sdkerrors/getalllibraries.go + - /models/sdkerrors/getavailableclients.go + - /models/sdkerrors/getbandwidthstatistics.go + - /models/sdkerrors/getbannerimage.go + - /models/sdkerrors/getbutlertasks.go + - /models/sdkerrors/getcompanionsdata.go + - /models/sdkerrors/getdevices.go + - /models/sdkerrors/getfilehash.go + - /models/sdkerrors/getgeodata.go + - /models/sdkerrors/getglobalhubs.go + - /models/sdkerrors/gethomedata.go + - /models/sdkerrors/getlibrarydetails.go + - /models/sdkerrors/getlibraryhubs.go + - /models/sdkerrors/getlibraryitems.go + - /models/sdkerrors/getmediaproviders.go + - /models/sdkerrors/getmetadatabyratingkey.go + - /models/sdkerrors/getmetadatachildren.go + - /models/sdkerrors/getmyplexaccount.go + - /models/sdkerrors/getondeck.go + - /models/sdkerrors/getpin.go + - /models/sdkerrors/getplaylist.go + - /models/sdkerrors/getplaylistcontents.go + - /models/sdkerrors/getplaylists.go + - /models/sdkerrors/getrecentlyadded.go + - /models/sdkerrors/getrefreshlibrarymetadata.go + - /models/sdkerrors/getresizedphoto.go + - /models/sdkerrors/getresourcesstatistics.go + - /models/sdkerrors/getsearchlibrary.go + - /models/sdkerrors/getsearchresults.go + - /models/sdkerrors/getserveractivities.go + - /models/sdkerrors/getservercapabilities.go + - /models/sdkerrors/getserveridentity.go + - /models/sdkerrors/getserverlist.go + - /models/sdkerrors/getserverpreferences.go + - /models/sdkerrors/getserverresources.go + - /models/sdkerrors/getsessionhistory.go + - /models/sdkerrors/getsessions.go + - /models/sdkerrors/getsourceconnectioninformation.go + - /models/sdkerrors/getstatistics.go + - /models/sdkerrors/getthumbimage.go + - /models/sdkerrors/gettimeline.go + - /models/sdkerrors/gettokenbypinid.go + - /models/sdkerrors/gettopwatchedcontent.go + - /models/sdkerrors/gettranscodesessions.go + - /models/sdkerrors/gettransienttoken.go + - /models/sdkerrors/getupdatestatus.go + - /models/sdkerrors/getuserdetails.go + - /models/sdkerrors/getuserfriends.go + - /models/sdkerrors/getwatchlist.go + - /models/sdkerrors/logline.go + - /models/sdkerrors/logmultiline.go + - /models/sdkerrors/markplayed.go + - /models/sdkerrors/markunplayed.go + - /models/sdkerrors/performsearch.go + - /models/sdkerrors/performvoicesearch.go + - /models/sdkerrors/postuserssignindata.go + - /models/sdkerrors/startalltasks.go + - /models/sdkerrors/starttask.go + - /models/sdkerrors/startuniversaltranscode.go + - /models/sdkerrors/stopalltasks.go + - /models/sdkerrors/stoptask.go + - /models/sdkerrors/stoptranscodesession.go + - /models/sdkerrors/updateplaylist.go + - /models/sdkerrors/updateplayprogress.go + - /models/sdkerrors/uploadplaylist.go + - CONTRIBUTING.md + - USAGE.md - activities.go - - butler.go - - plex.go - - hubs.go - - search.go - - library.go - - log.go - - playlists.go - authentication.go - - statistics.go - - sessions.go - - updater.go - - watchlist.go - - plexapi.go + - butler.go + - docs/models/components/security.md + - docs/models/operations/account.md + - docs/models/operations/activity.md + - docs/models/operations/addplaylistcontentsmediacontainer.md + - docs/models/operations/addplaylistcontentsmetadata.md + - docs/models/operations/addplaylistcontentsrequest.md + - docs/models/operations/addplaylistcontentsresponse.md + - docs/models/operations/addplaylistcontentsresponsebody.md + - docs/models/operations/applyupdatesrequest.md + - docs/models/operations/applyupdatesresponse.md + - docs/models/operations/autoselectsubtitle.md + - docs/models/operations/billing.md + - docs/models/operations/butlertask.md + - docs/models/operations/butlertasks.md + - docs/models/operations/cancelserveractivitiesrequest.md + - docs/models/operations/cancelserveractivitiesresponse.md + - docs/models/operations/checkforupdatesrequest.md + - docs/models/operations/checkforupdatesresponse.md + - docs/models/operations/clearplaylistcontentsrequest.md + - docs/models/operations/clearplaylistcontentsresponse.md + - docs/models/operations/connections.md + - docs/models/operations/context.md + - docs/models/operations/country.md + - docs/models/operations/createplaylistmediacontainer.md + - docs/models/operations/createplaylistmetadata.md + - docs/models/operations/createplaylistqueryparamtype.md + - docs/models/operations/createplaylistrequest.md + - docs/models/operations/createplaylistresponse.md + - docs/models/operations/createplaylistresponsebody.md + - docs/models/operations/defaultsubtitleaccessibility.md + - docs/models/operations/defaultsubtitleforced.md + - docs/models/operations/deletelibraryrequest.md + - docs/models/operations/deletelibraryresponse.md + - docs/models/operations/deleteplaylistrequest.md + - docs/models/operations/deleteplaylistresponse.md + - docs/models/operations/device.md + - docs/models/operations/director.md + - docs/models/operations/directory.md + - docs/models/operations/download.md + - docs/models/operations/enablepapertrailresponse.md + - docs/models/operations/feature.md + - docs/models/operations/features.md + - docs/models/operations/field.md + - docs/models/operations/fieldtype.md + - docs/models/operations/filter.md + - docs/models/operations/force.md + - docs/models/operations/friend.md + - docs/models/operations/genre.md + - docs/models/operations/geodata.md + - docs/models/operations/getalllibrariesdirectory.md + - docs/models/operations/getalllibrariesmediacontainer.md + - docs/models/operations/getalllibrariesresponse.md + - docs/models/operations/getalllibrariesresponsebody.md + - docs/models/operations/getavailableclientsmediacontainer.md + - docs/models/operations/getavailableclientsresponse.md + - docs/models/operations/getavailableclientsresponsebody.md + - docs/models/operations/getbandwidthstatisticsaccount.md + - docs/models/operations/getbandwidthstatisticsdevice.md + - docs/models/operations/getbandwidthstatisticsmediacontainer.md + - docs/models/operations/getbandwidthstatisticsrequest.md + - docs/models/operations/getbandwidthstatisticsresponse.md + - docs/models/operations/getbandwidthstatisticsresponsebody.md + - docs/models/operations/getbannerimagerequest.md + - docs/models/operations/getbannerimageresponse.md + - docs/models/operations/getbutlertasksresponse.md + - docs/models/operations/getbutlertasksresponsebody.md + - docs/models/operations/getcompanionsdataresponse.md + - docs/models/operations/getdevicesmediacontainer.md + - docs/models/operations/getdevicesresponse.md + - docs/models/operations/getdevicesresponsebody.md + - docs/models/operations/getfilehashrequest.md + - docs/models/operations/getfilehashresponse.md + - docs/models/operations/getgeodatageodata.md + - docs/models/operations/getgeodataresponse.md + - docs/models/operations/getglobalhubsmediacontainer.md + - docs/models/operations/getglobalhubsmetadata.md + - docs/models/operations/getglobalhubsrequest.md + - docs/models/operations/getglobalhubsresponse.md + - docs/models/operations/getglobalhubsresponsebody.md + - docs/models/operations/gethomedataresponse.md + - docs/models/operations/gethomedataresponsebody.md + - docs/models/operations/getlibrarydetailsdirectory.md + - docs/models/operations/getlibrarydetailsfilter.md + - docs/models/operations/getlibrarydetailsmediacontainer.md + - docs/models/operations/getlibrarydetailsrequest.md + - docs/models/operations/getlibrarydetailsresponse.md + - docs/models/operations/getlibrarydetailsresponsebody.md + - docs/models/operations/getlibrarydetailstype.md + - docs/models/operations/getlibraryhubscountry.md + - docs/models/operations/getlibraryhubsdirector.md + - docs/models/operations/getlibraryhubsgenre.md + - docs/models/operations/getlibraryhubshub.md + - docs/models/operations/getlibraryhubsmedia.md + - docs/models/operations/getlibraryhubsmediacontainer.md + - docs/models/operations/getlibraryhubsmetadata.md + - docs/models/operations/getlibraryhubspart.md + - docs/models/operations/getlibraryhubsrequest.md + - docs/models/operations/getlibraryhubsresponse.md + - docs/models/operations/getlibraryhubsresponsebody.md + - docs/models/operations/getlibraryhubsrole.md + - docs/models/operations/getlibraryhubswriter.md + - docs/models/operations/getlibraryitemscountry.md + - docs/models/operations/getlibraryitemsdirector.md + - docs/models/operations/getlibraryitemsgenre.md + - docs/models/operations/getlibraryitemsmedia.md + - docs/models/operations/getlibraryitemsmediacontainer.md + - docs/models/operations/getlibraryitemsmetadata.md + - docs/models/operations/getlibraryitemspart.md + - docs/models/operations/getlibraryitemsrequest.md + - docs/models/operations/getlibraryitemsresponse.md + - docs/models/operations/getlibraryitemsresponsebody.md + - docs/models/operations/getlibraryitemsrole.md + - docs/models/operations/getlibraryitemswriter.md + - docs/models/operations/getmediaprovidersdirectory.md + - docs/models/operations/getmediaprovidersmediacontainer.md + - docs/models/operations/getmediaprovidersrequest.md + - docs/models/operations/getmediaprovidersresponse.md + - docs/models/operations/getmediaprovidersresponsebody.md + - docs/models/operations/getmetadatabyratingkeycountry.md + - docs/models/operations/getmetadatabyratingkeydirector.md + - docs/models/operations/getmetadatabyratingkeygenre.md + - docs/models/operations/getmetadatabyratingkeymedia.md + - docs/models/operations/getmetadatabyratingkeymediacontainer.md + - docs/models/operations/getmetadatabyratingkeymetadata.md + - docs/models/operations/getmetadatabyratingkeypart.md + - docs/models/operations/getmetadatabyratingkeyrequest.md + - docs/models/operations/getmetadatabyratingkeyresponse.md + - docs/models/operations/getmetadatabyratingkeyresponsebody.md + - docs/models/operations/getmetadatabyratingkeyrole.md + - docs/models/operations/getmetadatabyratingkeywriter.md + - docs/models/operations/getmetadatachildrendirectory.md + - docs/models/operations/getmetadatachildrenmediacontainer.md + - docs/models/operations/getmetadatachildrenmetadata.md + - docs/models/operations/getmetadatachildrenrequest.md + - docs/models/operations/getmetadatachildrenresponse.md + - docs/models/operations/getmetadatachildrenresponsebody.md + - docs/models/operations/getmyplexaccountresponse.md + - docs/models/operations/getmyplexaccountresponsebody.md + - docs/models/operations/getondeckguids.md + - docs/models/operations/getondeckmedia.md + - docs/models/operations/getondeckmediacontainer.md + - docs/models/operations/getondeckmetadata.md + - docs/models/operations/getondeckpart.md + - docs/models/operations/getondeckresponse.md + - 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 + - docs/models/operations/getplaylistcontentsdirector.md + - docs/models/operations/getplaylistcontentsgenre.md + - docs/models/operations/getplaylistcontentsmedia.md + - docs/models/operations/getplaylistcontentsmediacontainer.md + - docs/models/operations/getplaylistcontentsmetadata.md + - docs/models/operations/getplaylistcontentspart.md + - docs/models/operations/getplaylistcontentsqueryparamtype.md + - docs/models/operations/getplaylistcontentsrequest.md + - docs/models/operations/getplaylistcontentsresponse.md + - docs/models/operations/getplaylistcontentsresponsebody.md + - docs/models/operations/getplaylistcontentsrole.md + - docs/models/operations/getplaylistcontentswriter.md + - docs/models/operations/getplaylistmediacontainer.md + - docs/models/operations/getplaylistmetadata.md + - docs/models/operations/getplaylistrequest.md + - docs/models/operations/getplaylistresponse.md + - docs/models/operations/getplaylistresponsebody.md + - docs/models/operations/getplaylistsmediacontainer.md + - docs/models/operations/getplaylistsmetadata.md + - docs/models/operations/getplaylistsrequest.md + - docs/models/operations/getplaylistsresponse.md + - docs/models/operations/getplaylistsresponsebody.md + - docs/models/operations/getrecentlyaddedmediacontainer.md + - docs/models/operations/getrecentlyaddedmetadata.md + - docs/models/operations/getrecentlyaddedrequest.md + - docs/models/operations/getrecentlyaddedresponse.md + - docs/models/operations/getrecentlyaddedresponsebody.md + - docs/models/operations/getrefreshlibrarymetadatarequest.md + - docs/models/operations/getrefreshlibrarymetadataresponse.md + - docs/models/operations/getresizedphotorequest.md + - docs/models/operations/getresizedphotoresponse.md + - docs/models/operations/getresourcesstatisticsmediacontainer.md + - docs/models/operations/getresourcesstatisticsrequest.md + - docs/models/operations/getresourcesstatisticsresponse.md + - docs/models/operations/getresourcesstatisticsresponsebody.md + - docs/models/operations/getsearchlibrarymediacontainer.md + - docs/models/operations/getsearchlibrarymetadata.md + - docs/models/operations/getsearchlibraryrequest.md + - docs/models/operations/getsearchlibraryresponse.md + - docs/models/operations/getsearchlibraryresponsebody.md + - docs/models/operations/getsearchresultscountry.md + - docs/models/operations/getsearchresultsdirector.md + - docs/models/operations/getsearchresultsgenre.md + - docs/models/operations/getsearchresultsmedia.md + - docs/models/operations/getsearchresultsmediacontainer.md + - docs/models/operations/getsearchresultsmetadata.md + - docs/models/operations/getsearchresultspart.md + - docs/models/operations/getsearchresultsrequest.md + - docs/models/operations/getsearchresultsresponse.md + - docs/models/operations/getsearchresultsresponsebody.md + - docs/models/operations/getsearchresultsrole.md + - docs/models/operations/getsearchresultswriter.md + - docs/models/operations/getserveractivitiesmediacontainer.md + - docs/models/operations/getserveractivitiesresponse.md + - docs/models/operations/getserveractivitiesresponsebody.md + - docs/models/operations/getservercapabilitiesresponse.md + - docs/models/operations/getservercapabilitiesresponsebody.md + - docs/models/operations/getserveridentitymediacontainer.md + - docs/models/operations/getserveridentityresponse.md + - docs/models/operations/getserveridentityresponsebody.md + - docs/models/operations/getserverlistmediacontainer.md + - docs/models/operations/getserverlistresponse.md + - docs/models/operations/getserverlistresponsebody.md + - docs/models/operations/getserverlistserver.md + - 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 + - docs/models/operations/getsessionhistorymetadata.md + - docs/models/operations/getsessionhistoryrequest.md + - docs/models/operations/getsessionhistoryresponse.md + - docs/models/operations/getsessionhistoryresponsebody.md + - docs/models/operations/getsessionsmedia.md + - docs/models/operations/getsessionsmediacontainer.md + - docs/models/operations/getsessionsmetadata.md + - docs/models/operations/getsessionspart.md + - docs/models/operations/getsessionsresponse.md + - docs/models/operations/getsessionsresponsebody.md + - docs/models/operations/getsessionsstream.md + - docs/models/operations/getsessionsuser.md + - docs/models/operations/getsourceconnectioninformationrequest.md + - docs/models/operations/getsourceconnectioninformationresponse.md + - docs/models/operations/getstatisticsdevice.md + - docs/models/operations/getstatisticsmediacontainer.md + - docs/models/operations/getstatisticsrequest.md + - docs/models/operations/getstatisticsresponse.md + - docs/models/operations/getstatisticsresponsebody.md + - docs/models/operations/getthumbimagerequest.md + - docs/models/operations/getthumbimageresponse.md + - docs/models/operations/gettimelinerequest.md + - 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/gettopwatchedcontentcountry.md + - docs/models/operations/gettopwatchedcontentgenre.md + - docs/models/operations/gettopwatchedcontentguids.md + - docs/models/operations/gettopwatchedcontentmediacontainer.md + - docs/models/operations/gettopwatchedcontentmetadata.md + - docs/models/operations/gettopwatchedcontentqueryparamtype.md + - docs/models/operations/gettopwatchedcontentrequest.md + - docs/models/operations/gettopwatchedcontentresponse.md + - docs/models/operations/gettopwatchedcontentresponsebody.md + - docs/models/operations/gettopwatchedcontentrole.md + - docs/models/operations/gettranscodesessionsmediacontainer.md + - docs/models/operations/gettranscodesessionsresponse.md + - docs/models/operations/gettranscodesessionsresponsebody.md + - docs/models/operations/gettransienttokenqueryparamtype.md + - docs/models/operations/gettransienttokenrequest.md + - docs/models/operations/gettransienttokenresponse.md + - docs/models/operations/getupdatestatusmediacontainer.md + - docs/models/operations/getupdatestatusresponse.md + - docs/models/operations/getupdatestatusresponsebody.md + - docs/models/operations/getuserdetailsauthenticationresponsestatus.md + - docs/models/operations/getuserdetailsauthenticationstatus.md + - docs/models/operations/getuserdetailsfeatures.md + - docs/models/operations/getuserdetailsrequest.md + - docs/models/operations/getuserdetailsresponse.md + - docs/models/operations/getuserdetailsstatus.md + - docs/models/operations/getuserdetailssubscription.md + - docs/models/operations/getuserdetailsuserplexaccount.md + - docs/models/operations/getuserfriendsresponse.md + - docs/models/operations/getwatchlistrequest.md + - docs/models/operations/getwatchlistresponse.md + - docs/models/operations/getwatchlistresponsebody.md + - docs/models/operations/guids.md + - docs/models/operations/hub.md + - docs/models/operations/image.md + - docs/models/operations/includecollections.md + - docs/models/operations/includedetails.md + - docs/models/operations/includeexternalmedia.md + - docs/models/operations/includeguids.md + - docs/models/operations/includehttps.md + - docs/models/operations/includeipv6.md + - docs/models/operations/includemeta.md + - docs/models/operations/includerelay.md + - docs/models/operations/internalpaymentmethod.md + - docs/models/operations/level.md + - docs/models/operations/librarysectionid.md + - docs/models/operations/libtype.md + - docs/models/operations/location.md + - docs/models/operations/loglinerequest.md + - docs/models/operations/loglineresponse.md + - docs/models/operations/logmultilineresponse.md + - docs/models/operations/mailingliststatus.md + - docs/models/operations/markplayedrequest.md + - docs/models/operations/markplayedresponse.md + - docs/models/operations/markunplayedrequest.md + - docs/models/operations/markunplayedresponse.md + - docs/models/operations/media.md + - docs/models/operations/mediacontainer.md + - docs/models/operations/mediaprovider.md + - docs/models/operations/mediareviewsvisibility.md + - docs/models/operations/metadata.md + - docs/models/operations/minsize.md + - docs/models/operations/myplex.md + - docs/models/operations/onlytransient.md + - docs/models/operations/operator.md + - docs/models/operations/option.md + - docs/models/operations/part.md + - docs/models/operations/pastsubscription.md + - docs/models/operations/pathparamtaskname.md + - docs/models/operations/performsearchrequest.md + - docs/models/operations/performsearchresponse.md + - docs/models/operations/performvoicesearchrequest.md + - docs/models/operations/performvoicesearchresponse.md + - docs/models/operations/pivot.md + - docs/models/operations/player.md + - docs/models/operations/playlisttype.md + - docs/models/operations/plexdevice.md + - docs/models/operations/postuserssignindataauthenticationfeatures.md + - docs/models/operations/postuserssignindataauthenticationresponsestatus.md + - docs/models/operations/postuserssignindataauthenticationstatus.md + - docs/models/operations/postuserssignindataauthenticationsubscription.md + - docs/models/operations/postuserssignindataautoselectsubtitle.md + - docs/models/operations/postuserssignindatadefaultsubtitleaccessibility.md + - docs/models/operations/postuserssignindatadefaultsubtitleforced.md + - docs/models/operations/postuserssignindatafeatures.md + - docs/models/operations/postuserssignindataglobals.md + - docs/models/operations/postuserssignindatamailingliststatus.md + - docs/models/operations/postuserssignindatamediareviewsvisibility.md + - docs/models/operations/postuserssignindatarequest.md + - docs/models/operations/postuserssignindatarequestbody.md + - docs/models/operations/postuserssignindataresponse.md + - docs/models/operations/postuserssignindataservices.md + - docs/models/operations/postuserssignindatastate.md + - docs/models/operations/postuserssignindatastatus.md + - docs/models/operations/postuserssignindatasubscription.md + - docs/models/operations/postuserssignindatauserplexaccount.md + - docs/models/operations/postuserssignindatauserprofile.md + - docs/models/operations/postuserssignindatawatchedindicator.md + - docs/models/operations/producer.md + - docs/models/operations/provider.md + - docs/models/operations/queryparamfilter.md + - docs/models/operations/queryparamforce.md + - docs/models/operations/queryparamonlytransient.md + - docs/models/operations/queryparamsmart.md + - docs/models/operations/queryparamtype.md + - docs/models/operations/ratings.md + - docs/models/operations/release.md + - docs/models/operations/responsebody.md + - docs/models/operations/role.md + - docs/models/operations/scope.md + - docs/models/operations/server.md + - docs/models/operations/services.md + - docs/models/operations/session.md + - docs/models/operations/setting.md + - docs/models/operations/sharedservers.md + - docs/models/operations/sharedsources.md + - docs/models/operations/skip.md + - docs/models/operations/smart.md + - docs/models/operations/sort.md + - docs/models/operations/startalltasksresponse.md + - docs/models/operations/starttaskrequest.md + - docs/models/operations/starttaskresponse.md + - docs/models/operations/startuniversaltranscoderequest.md + - docs/models/operations/startuniversaltranscoderesponse.md + - docs/models/operations/state.md + - docs/models/operations/statisticsbandwidth.md + - docs/models/operations/statisticsmedia.md + - docs/models/operations/statisticsresources.md + - docs/models/operations/status.md + - docs/models/operations/stopalltasksresponse.md + - docs/models/operations/stoptaskrequest.md + - docs/models/operations/stoptaskresponse.md + - docs/models/operations/stoptranscodesessionrequest.md + - docs/models/operations/stoptranscodesessionresponse.md + - docs/models/operations/stream.md + - docs/models/operations/subscription.md + - docs/models/operations/tag.md + - docs/models/operations/taskname.md + - docs/models/operations/tonight.md + - docs/models/operations/transcodesession.md + - docs/models/operations/trials.md + - docs/models/operations/type.md + - docs/models/operations/updateplaylistrequest.md + - docs/models/operations/updateplaylistresponse.md + - docs/models/operations/updateplayprogressrequest.md + - docs/models/operations/updateplayprogressresponse.md + - docs/models/operations/uploadplaylistrequest.md + - docs/models/operations/uploadplaylistresponse.md + - docs/models/operations/upscale.md + - docs/models/operations/user.md + - docs/models/operations/userprofile.md + - docs/models/operations/watchedindicator.md + - docs/models/operations/writer.md + - docs/models/sdkerrors/addplaylistcontentserrors.md + - docs/models/sdkerrors/addplaylistcontentsplaylistserrors.md + - docs/models/sdkerrors/addplaylistcontentsplaylistsresponsebody.md + - docs/models/sdkerrors/addplaylistcontentsresponsebody.md + - docs/models/sdkerrors/applyupdateserrors.md + - docs/models/sdkerrors/applyupdatesresponsebody.md + - docs/models/sdkerrors/applyupdatesupdatererrors.md + - docs/models/sdkerrors/applyupdatesupdaterresponsebody.md + - docs/models/sdkerrors/cancelserveractivitiesactivitieserrors.md + - docs/models/sdkerrors/cancelserveractivitiesactivitiesresponsebody.md + - docs/models/sdkerrors/cancelserveractivitieserrors.md + - docs/models/sdkerrors/cancelserveractivitiesresponsebody.md + - docs/models/sdkerrors/checkforupdateserrors.md + - docs/models/sdkerrors/checkforupdatesresponsebody.md + - docs/models/sdkerrors/checkforupdatesupdatererrors.md + - docs/models/sdkerrors/checkforupdatesupdaterresponsebody.md + - docs/models/sdkerrors/clearplaylistcontentserrors.md + - docs/models/sdkerrors/clearplaylistcontentsplaylistserrors.md + - docs/models/sdkerrors/clearplaylistcontentsplaylistsresponsebody.md + - docs/models/sdkerrors/clearplaylistcontentsresponsebody.md + - docs/models/sdkerrors/createplaylisterrors.md + - docs/models/sdkerrors/createplaylistplaylistserrors.md + - docs/models/sdkerrors/createplaylistplaylistsresponsebody.md + - docs/models/sdkerrors/createplaylistresponsebody.md + - docs/models/sdkerrors/deletelibraryerrors.md + - docs/models/sdkerrors/deletelibrarylibraryerrors.md + - docs/models/sdkerrors/deletelibrarylibraryresponsebody.md + - docs/models/sdkerrors/deletelibraryresponsebody.md + - docs/models/sdkerrors/deleteplaylisterrors.md + - docs/models/sdkerrors/deleteplaylistplaylistserrors.md + - docs/models/sdkerrors/deleteplaylistplaylistsresponsebody.md + - docs/models/sdkerrors/deleteplaylistresponsebody.md + - docs/models/sdkerrors/enablepapertrailerrors.md + - docs/models/sdkerrors/enablepapertraillogerrors.md + - docs/models/sdkerrors/enablepapertraillogresponsebody.md + - docs/models/sdkerrors/enablepapertrailresponsebody.md + - docs/models/sdkerrors/errors.md + - docs/models/sdkerrors/getalllibrarieserrors.md + - docs/models/sdkerrors/getalllibrarieslibraryerrors.md + - docs/models/sdkerrors/getalllibrarieslibraryresponsebody.md + - docs/models/sdkerrors/getalllibrariesresponsebody.md + - docs/models/sdkerrors/getavailableclientserrors.md + - docs/models/sdkerrors/getavailableclientsresponsebody.md + - docs/models/sdkerrors/getavailableclientsservererrors.md + - docs/models/sdkerrors/getavailableclientsserverresponsebody.md + - docs/models/sdkerrors/getbandwidthstatisticserrors.md + - docs/models/sdkerrors/getbandwidthstatisticsresponsebody.md + - docs/models/sdkerrors/getbandwidthstatisticsstatisticserrors.md + - docs/models/sdkerrors/getbandwidthstatisticsstatisticsresponsebody.md + - docs/models/sdkerrors/getbannerimageerrors.md + - docs/models/sdkerrors/getbannerimagemediaerrors.md + - docs/models/sdkerrors/getbannerimagemediaresponsebody.md + - docs/models/sdkerrors/getbannerimageresponsebody.md + - docs/models/sdkerrors/getbutlertasksbutlererrors.md + - docs/models/sdkerrors/getbutlertasksbutlerresponsebody.md + - docs/models/sdkerrors/getbutlertaskserrors.md + - docs/models/sdkerrors/getbutlertasksresponsebody.md + - docs/models/sdkerrors/getcompanionsdataerrors.md + - docs/models/sdkerrors/getcompanionsdataplexerrors.md + - docs/models/sdkerrors/getcompanionsdataplexresponsebody.md + - docs/models/sdkerrors/getcompanionsdataresponsebody.md + - docs/models/sdkerrors/getdeviceserrors.md + - docs/models/sdkerrors/getdevicesresponsebody.md + - docs/models/sdkerrors/getdevicesservererrors.md + - docs/models/sdkerrors/getdevicesserverresponsebody.md + - docs/models/sdkerrors/getfilehasherrors.md + - docs/models/sdkerrors/getfilehashlibraryerrors.md + - docs/models/sdkerrors/getfilehashlibraryresponsebody.md + - docs/models/sdkerrors/getfilehashresponsebody.md + - docs/models/sdkerrors/getgeodataerrors.md + - docs/models/sdkerrors/getgeodataplexerrors.md + - docs/models/sdkerrors/getgeodataplexresponsebody.md + - docs/models/sdkerrors/getgeodataresponsebody.md + - docs/models/sdkerrors/getglobalhubserrors.md + - docs/models/sdkerrors/getglobalhubshubserrors.md + - docs/models/sdkerrors/getglobalhubshubsresponsebody.md + - docs/models/sdkerrors/getglobalhubsresponsebody.md + - docs/models/sdkerrors/gethomedataerrors.md + - docs/models/sdkerrors/gethomedataplexerrors.md + - docs/models/sdkerrors/gethomedataplexresponsebody.md + - docs/models/sdkerrors/gethomedataresponsebody.md + - docs/models/sdkerrors/getlibrarydetailserrors.md + - docs/models/sdkerrors/getlibrarydetailslibraryerrors.md + - docs/models/sdkerrors/getlibrarydetailslibraryresponsebody.md + - docs/models/sdkerrors/getlibrarydetailsresponsebody.md + - docs/models/sdkerrors/getlibraryhubserrors.md + - docs/models/sdkerrors/getlibraryhubshubserrors.md + - docs/models/sdkerrors/getlibraryhubshubsresponsebody.md + - docs/models/sdkerrors/getlibraryhubsresponsebody.md + - docs/models/sdkerrors/getlibraryitemserrors.md + - docs/models/sdkerrors/getlibraryitemslibraryerrors.md + - docs/models/sdkerrors/getlibraryitemslibraryresponsebody.md + - docs/models/sdkerrors/getlibraryitemsresponsebody.md + - docs/models/sdkerrors/getmediaproviderserrors.md + - docs/models/sdkerrors/getmediaprovidersresponsebody.md + - docs/models/sdkerrors/getmediaprovidersservererrors.md + - docs/models/sdkerrors/getmediaprovidersserverresponsebody.md + - docs/models/sdkerrors/getmetadatabyratingkeyerrors.md + - docs/models/sdkerrors/getmetadatabyratingkeylibraryerrors.md + - docs/models/sdkerrors/getmetadatabyratingkeylibraryresponsebody.md + - docs/models/sdkerrors/getmetadatabyratingkeyresponsebody.md + - docs/models/sdkerrors/getmetadatachildrenerrors.md + - docs/models/sdkerrors/getmetadatachildrenlibraryerrors.md + - docs/models/sdkerrors/getmetadatachildrenlibraryresponsebody.md + - docs/models/sdkerrors/getmetadatachildrenresponsebody.md + - docs/models/sdkerrors/getmyplexaccounterrors.md + - docs/models/sdkerrors/getmyplexaccountresponsebody.md + - docs/models/sdkerrors/getmyplexaccountservererrors.md + - docs/models/sdkerrors/getmyplexaccountserverresponsebody.md + - docs/models/sdkerrors/getondeckerrors.md + - docs/models/sdkerrors/getondecklibraryerrors.md + - docs/models/sdkerrors/getondecklibraryresponsebody.md + - docs/models/sdkerrors/getondeckresponsebody.md + - docs/models/sdkerrors/getpinerrors.md + - docs/models/sdkerrors/getpinresponsebody.md + - docs/models/sdkerrors/getplaylistcontentserrors.md + - docs/models/sdkerrors/getplaylistcontentsplaylistserrors.md + - docs/models/sdkerrors/getplaylistcontentsplaylistsresponsebody.md + - docs/models/sdkerrors/getplaylistcontentsresponsebody.md + - docs/models/sdkerrors/getplaylisterrors.md + - docs/models/sdkerrors/getplaylistplaylistserrors.md + - docs/models/sdkerrors/getplaylistplaylistsresponsebody.md + - docs/models/sdkerrors/getplaylistresponsebody.md + - docs/models/sdkerrors/getplaylistserrors.md + - docs/models/sdkerrors/getplaylistsplaylistserrors.md + - docs/models/sdkerrors/getplaylistsplaylistsresponsebody.md + - docs/models/sdkerrors/getplaylistsresponsebody.md + - docs/models/sdkerrors/getrecentlyaddederrors.md + - docs/models/sdkerrors/getrecentlyaddedlibraryerrors.md + - docs/models/sdkerrors/getrecentlyaddedlibraryresponsebody.md + - docs/models/sdkerrors/getrecentlyaddedresponsebody.md + - docs/models/sdkerrors/getrefreshlibrarymetadataerrors.md + - docs/models/sdkerrors/getrefreshlibrarymetadatalibraryerrors.md + - docs/models/sdkerrors/getrefreshlibrarymetadatalibraryresponsebody.md + - docs/models/sdkerrors/getrefreshlibrarymetadataresponsebody.md + - docs/models/sdkerrors/getresizedphotoerrors.md + - docs/models/sdkerrors/getresizedphotoresponsebody.md + - docs/models/sdkerrors/getresizedphotoservererrors.md + - docs/models/sdkerrors/getresizedphotoserverresponsebody.md + - docs/models/sdkerrors/getresourcesstatisticserrors.md + - docs/models/sdkerrors/getresourcesstatisticsresponsebody.md + - docs/models/sdkerrors/getresourcesstatisticsstatisticserrors.md + - docs/models/sdkerrors/getresourcesstatisticsstatisticsresponsebody.md + - docs/models/sdkerrors/getsearchlibraryerrors.md + - docs/models/sdkerrors/getsearchlibrarylibraryerrors.md + - docs/models/sdkerrors/getsearchlibrarylibraryresponsebody.md + - docs/models/sdkerrors/getsearchlibraryresponsebody.md + - docs/models/sdkerrors/getsearchresultserrors.md + - docs/models/sdkerrors/getsearchresultsresponsebody.md + - docs/models/sdkerrors/getsearchresultssearcherrors.md + - docs/models/sdkerrors/getsearchresultssearchresponsebody.md + - docs/models/sdkerrors/getserveractivitiesactivitieserrors.md + - docs/models/sdkerrors/getserveractivitiesactivitiesresponsebody.md + - docs/models/sdkerrors/getserveractivitieserrors.md + - docs/models/sdkerrors/getserveractivitiesresponsebody.md + - docs/models/sdkerrors/getservercapabilitieserrors.md + - docs/models/sdkerrors/getservercapabilitiesresponsebody.md + - docs/models/sdkerrors/getservercapabilitiesserverresponsebody.md + - docs/models/sdkerrors/getserveridentityresponsebody.md + - docs/models/sdkerrors/getserverlisterrors.md + - docs/models/sdkerrors/getserverlistresponsebody.md + - docs/models/sdkerrors/getserverlistservererrors.md + - docs/models/sdkerrors/getserverlistserverresponsebody.md + - docs/models/sdkerrors/getserverpreferenceserrors.md + - docs/models/sdkerrors/getserverpreferencesresponsebody.md + - docs/models/sdkerrors/getserverpreferencesservererrors.md + - docs/models/sdkerrors/getserverpreferencesserverresponsebody.md + - docs/models/sdkerrors/getserverresourceserrors.md + - docs/models/sdkerrors/getserverresourcesplexerrors.md + - docs/models/sdkerrors/getserverresourcesplexresponsebody.md + - docs/models/sdkerrors/getserverresourcesresponsebody.md + - docs/models/sdkerrors/getsessionhistoryerrors.md + - docs/models/sdkerrors/getsessionhistoryresponsebody.md + - docs/models/sdkerrors/getsessionhistorysessionserrors.md + - docs/models/sdkerrors/getsessionhistorysessionsresponsebody.md + - docs/models/sdkerrors/getsessionserrors.md + - docs/models/sdkerrors/getsessionsresponsebody.md + - docs/models/sdkerrors/getsessionssessionserrors.md + - docs/models/sdkerrors/getsessionssessionsresponsebody.md + - docs/models/sdkerrors/getsourceconnectioninformationauthenticationerrors.md + - docs/models/sdkerrors/getsourceconnectioninformationauthenticationresponsebody.md + - docs/models/sdkerrors/getsourceconnectioninformationerrors.md + - docs/models/sdkerrors/getsourceconnectioninformationresponsebody.md + - docs/models/sdkerrors/getstatisticserrors.md + - docs/models/sdkerrors/getstatisticsresponsebody.md + - docs/models/sdkerrors/getstatisticsstatisticserrors.md + - docs/models/sdkerrors/getstatisticsstatisticsresponsebody.md + - docs/models/sdkerrors/getthumbimageerrors.md + - docs/models/sdkerrors/getthumbimagemediaerrors.md + - docs/models/sdkerrors/getthumbimagemediaresponsebody.md + - docs/models/sdkerrors/getthumbimageresponsebody.md + - docs/models/sdkerrors/gettimelineerrors.md + - docs/models/sdkerrors/gettimelineresponsebody.md + - docs/models/sdkerrors/gettimelinevideoerrors.md + - docs/models/sdkerrors/gettimelinevideoresponsebody.md + - docs/models/sdkerrors/gettokenbypiniderrors.md + - docs/models/sdkerrors/gettokenbypinidplexerrors.md + - docs/models/sdkerrors/gettokenbypinidplexresponsebody.md + - docs/models/sdkerrors/gettokenbypinidresponsebody.md + - docs/models/sdkerrors/gettopwatchedcontenterrors.md + - docs/models/sdkerrors/gettopwatchedcontentlibraryerrors.md + - docs/models/sdkerrors/gettopwatchedcontentlibraryresponsebody.md + - docs/models/sdkerrors/gettopwatchedcontentresponsebody.md + - docs/models/sdkerrors/gettranscodesessionserrors.md + - docs/models/sdkerrors/gettranscodesessionsresponsebody.md + - docs/models/sdkerrors/gettranscodesessionssessionserrors.md + - docs/models/sdkerrors/gettranscodesessionssessionsresponsebody.md + - docs/models/sdkerrors/gettransienttokenauthenticationerrors.md + - docs/models/sdkerrors/gettransienttokenauthenticationresponsebody.md + - docs/models/sdkerrors/gettransienttokenerrors.md + - docs/models/sdkerrors/gettransienttokenresponsebody.md + - docs/models/sdkerrors/getupdatestatuserrors.md + - docs/models/sdkerrors/getupdatestatusresponsebody.md + - docs/models/sdkerrors/getupdatestatusupdatererrors.md + - docs/models/sdkerrors/getupdatestatusupdaterresponsebody.md + - docs/models/sdkerrors/getuserdetailsauthenticationerrors.md + - docs/models/sdkerrors/getuserdetailsauthenticationresponsebody.md + - docs/models/sdkerrors/getuserdetailserrors.md + - docs/models/sdkerrors/getuserdetailsresponsebody.md + - docs/models/sdkerrors/getuserfriendserrors.md + - docs/models/sdkerrors/getuserfriendsplexerrors.md + - docs/models/sdkerrors/getuserfriendsplexresponsebody.md + - docs/models/sdkerrors/getuserfriendsresponsebody.md + - docs/models/sdkerrors/getwatchlisterrors.md + - docs/models/sdkerrors/getwatchlistresponsebody.md + - docs/models/sdkerrors/getwatchlistwatchlisterrors.md + - docs/models/sdkerrors/getwatchlistwatchlistresponsebody.md + - docs/models/sdkerrors/loglineerrors.md + - docs/models/sdkerrors/loglinelogerrors.md + - docs/models/sdkerrors/loglinelogresponsebody.md + - docs/models/sdkerrors/loglineresponsebody.md + - docs/models/sdkerrors/logmultilineerrors.md + - docs/models/sdkerrors/logmultilinelogerrors.md + - docs/models/sdkerrors/logmultilinelogresponsebody.md + - docs/models/sdkerrors/logmultilineresponsebody.md + - docs/models/sdkerrors/markplayederrors.md + - docs/models/sdkerrors/markplayedmediaerrors.md + - docs/models/sdkerrors/markplayedmediaresponsebody.md + - docs/models/sdkerrors/markplayedresponsebody.md + - docs/models/sdkerrors/markunplayederrors.md + - docs/models/sdkerrors/markunplayedmediaerrors.md + - docs/models/sdkerrors/markunplayedmediaresponsebody.md + - docs/models/sdkerrors/markunplayedresponsebody.md + - docs/models/sdkerrors/performsearcherrors.md + - docs/models/sdkerrors/performsearchresponsebody.md + - docs/models/sdkerrors/performsearchsearcherrors.md + - docs/models/sdkerrors/performsearchsearchresponsebody.md + - docs/models/sdkerrors/performvoicesearcherrors.md + - docs/models/sdkerrors/performvoicesearchresponsebody.md + - docs/models/sdkerrors/performvoicesearchsearcherrors.md + - docs/models/sdkerrors/performvoicesearchsearchresponsebody.md + - docs/models/sdkerrors/postuserssignindataauthenticationerrors.md + - docs/models/sdkerrors/postuserssignindataauthenticationresponsebody.md + - docs/models/sdkerrors/postuserssignindataerrors.md + - docs/models/sdkerrors/postuserssignindataresponsebody.md + - docs/models/sdkerrors/startalltasksbutlererrors.md + - docs/models/sdkerrors/startalltasksbutlerresponsebody.md + - docs/models/sdkerrors/startalltaskserrors.md + - docs/models/sdkerrors/startalltasksresponsebody.md + - docs/models/sdkerrors/starttaskbutlererrors.md + - docs/models/sdkerrors/starttaskbutlerresponsebody.md + - docs/models/sdkerrors/starttaskerrors.md + - docs/models/sdkerrors/starttaskresponsebody.md + - docs/models/sdkerrors/startuniversaltranscodeerrors.md + - docs/models/sdkerrors/startuniversaltranscoderesponsebody.md + - docs/models/sdkerrors/startuniversaltranscodevideoerrors.md + - docs/models/sdkerrors/startuniversaltranscodevideoresponsebody.md + - docs/models/sdkerrors/stopalltasksbutlererrors.md + - docs/models/sdkerrors/stopalltasksbutlerresponsebody.md + - docs/models/sdkerrors/stopalltaskserrors.md + - docs/models/sdkerrors/stopalltasksresponsebody.md + - docs/models/sdkerrors/stoptaskbutlererrors.md + - docs/models/sdkerrors/stoptaskbutlerresponsebody.md + - docs/models/sdkerrors/stoptaskerrors.md + - docs/models/sdkerrors/stoptaskresponsebody.md + - docs/models/sdkerrors/stoptranscodesessionerrors.md + - docs/models/sdkerrors/stoptranscodesessionresponsebody.md + - docs/models/sdkerrors/stoptranscodesessionsessionserrors.md + - docs/models/sdkerrors/stoptranscodesessionsessionsresponsebody.md + - docs/models/sdkerrors/updateplaylisterrors.md + - docs/models/sdkerrors/updateplaylistplaylistserrors.md + - docs/models/sdkerrors/updateplaylistplaylistsresponsebody.md + - docs/models/sdkerrors/updateplaylistresponsebody.md + - docs/models/sdkerrors/updateplayprogresserrors.md + - docs/models/sdkerrors/updateplayprogressmediaerrors.md + - docs/models/sdkerrors/updateplayprogressmediaresponsebody.md + - docs/models/sdkerrors/updateplayprogressresponsebody.md + - docs/models/sdkerrors/uploadplaylisterrors.md + - docs/models/sdkerrors/uploadplaylistplaylistserrors.md + - docs/models/sdkerrors/uploadplaylistplaylistsresponsebody.md + - docs/models/sdkerrors/uploadplaylistresponsebody.md + - docs/sdks/activities/README.md + - docs/sdks/authentication/README.md + - docs/sdks/butler/README.md + - docs/sdks/hubs/README.md + - docs/sdks/library/README.md + - docs/sdks/log/README.md + - docs/sdks/media/README.md + - docs/sdks/playlists/README.md + - docs/sdks/plex/README.md + - docs/sdks/plexapi/README.md + - docs/sdks/search/README.md + - docs/sdks/server/README.md + - docs/sdks/sessions/README.md + - docs/sdks/statistics/README.md + - docs/sdks/updater/README.md + - docs/sdks/video/README.md + - docs/sdks/watchlist/README.md + - docs/types/date.md - go.mod - - models/sdkerrors/sdkerror.go - - types/bigint.go - - types/date.go - - types/datetime.go - - types/decimal.go - - types/pointers.go + - hubs.go + - internal/globals/globals.go + - internal/hooks/hooks.go - internal/utils/contenttype.go - internal/utils/form.go - internal/utils/headers.go @@ -65,607 +916,943 @@ generatedFiles: - internal/utils/retries.go - internal/utils/security.go - internal/utils/utils.go - - internal/globals/globals.go - - /models/operations/getservercapabilities.go - - /models/operations/getserverpreferences.go - - /models/operations/getavailableclients.go - - /models/operations/getdevices.go - - /models/operations/getserveridentity.go - - /models/operations/getmyplexaccount.go - - /models/operations/getresizedphoto.go - - /models/operations/getserverlist.go - - /models/operations/markplayed.go - - /models/operations/markunplayed.go - - /models/operations/updateplayprogress.go - - /models/operations/gettimeline.go - - /models/operations/startuniversaltranscode.go - - /models/operations/getserveractivities.go - - /models/operations/cancelserveractivities.go - - /models/operations/getbutlertasks.go - - /models/operations/startalltasks.go - - /models/operations/stopalltasks.go - - /models/operations/starttask.go - - /models/operations/stoptask.go - - /models/operations/gethomedata.go - - /models/operations/getpin.go - - /models/operations/gettoken.go - - /models/operations/getglobalhubs.go - - /models/operations/getlibraryhubs.go - - /models/operations/performsearch.go - - /models/operations/performvoicesearch.go - - /models/operations/getsearchresults.go - - /models/operations/getfilehash.go - - /models/operations/getrecentlyadded.go - - /models/operations/getlibraries.go - - /models/operations/getlibrary.go - - /models/operations/deletelibrary.go - - /models/operations/getlibraryitems.go - - /models/operations/refreshlibrary.go - - /models/operations/searchlibrary.go - - /models/operations/getmetadata.go - - /models/operations/getmetadatachildren.go - - /models/operations/gettopwatchedcontent.go - - /models/operations/getondeck.go - - /models/operations/logline.go - - /models/operations/logmultiline.go - - /models/operations/enablepapertrail.go - - /models/operations/createplaylist.go - - /models/operations/getplaylists.go - - /models/operations/getplaylist.go - - /models/operations/deleteplaylist.go - - /models/operations/updateplaylist.go - - /models/operations/getplaylistcontents.go - - /models/operations/clearplaylistcontents.go - - /models/operations/addplaylistcontents.go - - /models/operations/uploadplaylist.go - - /models/operations/gettransienttoken.go - - /models/operations/getsourceconnectioninformation.go - - /models/operations/getstatistics.go - - /models/operations/getresourcesstatistics.go - - /models/operations/getbandwidthstatistics.go - - /models/operations/getsessions.go - - /models/operations/getsessionhistory.go - - /models/operations/gettranscodesessions.go - - /models/operations/stoptranscodesession.go - - /models/operations/getupdatestatus.go - - /models/operations/checkforupdates.go - - /models/operations/applyupdates.go - - /models/operations/getwatchlist.go - - /models/sdkerrors/getservercapabilities.go - - /models/sdkerrors/getserverpreferences.go - - /models/sdkerrors/getavailableclients.go - - /models/sdkerrors/getdevices.go - - /models/sdkerrors/getserveridentity.go - - /models/sdkerrors/getmyplexaccount.go - - /models/sdkerrors/getresizedphoto.go - - /models/sdkerrors/getserverlist.go - - /models/sdkerrors/markplayed.go - - /models/sdkerrors/markunplayed.go - - /models/sdkerrors/updateplayprogress.go - - /models/sdkerrors/gettimeline.go - - /models/sdkerrors/startuniversaltranscode.go - - /models/sdkerrors/getserveractivities.go - - /models/sdkerrors/cancelserveractivities.go - - /models/sdkerrors/getbutlertasks.go - - /models/sdkerrors/startalltasks.go - - /models/sdkerrors/stopalltasks.go - - /models/sdkerrors/starttask.go - - /models/sdkerrors/stoptask.go - - /models/sdkerrors/gethomedata.go - - /models/sdkerrors/getpin.go - - /models/sdkerrors/gettoken.go - - /models/sdkerrors/getglobalhubs.go - - /models/sdkerrors/getlibraryhubs.go - - /models/sdkerrors/performsearch.go - - /models/sdkerrors/performvoicesearch.go - - /models/sdkerrors/getsearchresults.go - - /models/sdkerrors/getfilehash.go - - /models/sdkerrors/getrecentlyadded.go - - /models/sdkerrors/getlibraries.go - - /models/sdkerrors/getlibrary.go - - /models/sdkerrors/deletelibrary.go - - /models/sdkerrors/getlibraryitems.go - - /models/sdkerrors/refreshlibrary.go - - /models/sdkerrors/searchlibrary.go - - /models/sdkerrors/getmetadata.go - - /models/sdkerrors/getmetadatachildren.go - - /models/sdkerrors/getondeck.go - - /models/sdkerrors/logline.go - - /models/sdkerrors/logmultiline.go - - /models/sdkerrors/enablepapertrail.go - - /models/sdkerrors/createplaylist.go - - /models/sdkerrors/getplaylists.go - - /models/sdkerrors/getplaylist.go - - /models/sdkerrors/deleteplaylist.go - - /models/sdkerrors/updateplaylist.go - - /models/sdkerrors/getplaylistcontents.go - - /models/sdkerrors/clearplaylistcontents.go - - /models/sdkerrors/addplaylistcontents.go - - /models/sdkerrors/uploadplaylist.go - - /models/sdkerrors/gettransienttoken.go - - /models/sdkerrors/getsourceconnectioninformation.go - - /models/sdkerrors/getstatistics.go - - /models/sdkerrors/getresourcesstatistics.go - - /models/sdkerrors/getbandwidthstatistics.go - - /models/sdkerrors/getsessions.go - - /models/sdkerrors/getsessionhistory.go - - /models/sdkerrors/gettranscodesessions.go - - /models/sdkerrors/stoptranscodesession.go - - /models/sdkerrors/getupdatestatus.go - - /models/sdkerrors/checkforupdates.go - - /models/sdkerrors/applyupdates.go - - /models/sdkerrors/getwatchlist.go - - /models/components/security.go - - docs/models/operations/directory.md - - docs/models/operations/mediacontainer.md - - docs/models/operations/getservercapabilitiesresponsebody.md - - docs/models/operations/getservercapabilitiesresponse.md - - docs/models/operations/setting.md - - docs/models/operations/getserverpreferencesmediacontainer.md - - docs/models/operations/getserverpreferencesresponsebody.md - - docs/models/operations/getserverpreferencesresponse.md - - docs/models/operations/server.md - - docs/models/operations/getavailableclientsmediacontainer.md - - docs/models/operations/getavailableclientsresponsebody.md - - docs/models/operations/getavailableclientsresponse.md - - docs/models/operations/device.md - - docs/models/operations/getdevicesmediacontainer.md - - docs/models/operations/getdevicesresponsebody.md - - docs/models/operations/getdevicesresponse.md - - docs/models/operations/getserveridentitymediacontainer.md - - docs/models/operations/getserveridentityresponsebody.md - - docs/models/operations/getserveridentityresponse.md - - docs/models/operations/myplex.md - - docs/models/operations/getmyplexaccountresponsebody.md - - docs/models/operations/getmyplexaccountresponse.md - - docs/models/operations/minsize.md - - docs/models/operations/upscale.md - - docs/models/operations/getresizedphotorequest.md - - docs/models/operations/getresizedphotoresponse.md - - docs/models/operations/getserverlistserver.md - - docs/models/operations/getserverlistmediacontainer.md - - docs/models/operations/getserverlistresponsebody.md - - docs/models/operations/getserverlistresponse.md - - docs/models/operations/markplayedrequest.md - - docs/models/operations/markplayedresponse.md - - docs/models/operations/markunplayedrequest.md - - docs/models/operations/markunplayedresponse.md - - docs/models/operations/updateplayprogressrequest.md - - docs/models/operations/updateplayprogressresponse.md - - docs/models/operations/state.md - - docs/models/operations/gettimelinerequest.md - - docs/models/operations/gettimelineresponse.md - - docs/models/operations/startuniversaltranscoderequest.md - - docs/models/operations/startuniversaltranscoderesponse.md - - docs/models/operations/context.md - - docs/models/operations/activity.md - - docs/models/operations/getserveractivitiesmediacontainer.md - - docs/models/operations/getserveractivitiesresponsebody.md - - docs/models/operations/getserveractivitiesresponse.md - - docs/models/operations/cancelserveractivitiesrequest.md - - docs/models/operations/cancelserveractivitiesresponse.md - - docs/models/operations/butlertask.md - - docs/models/operations/butlertasks.md - - docs/models/operations/getbutlertasksresponsebody.md - - docs/models/operations/getbutlertasksresponse.md - - docs/models/operations/startalltasksresponse.md - - docs/models/operations/stopalltasksresponse.md - - docs/models/operations/taskname.md - - docs/models/operations/starttaskrequest.md - - docs/models/operations/starttaskresponse.md - - docs/models/operations/pathparamtaskname.md - - docs/models/operations/stoptaskrequest.md - - docs/models/operations/stoptaskresponse.md - - docs/models/operations/gethomedataresponsebody.md - - docs/models/operations/gethomedataresponse.md - - docs/models/operations/getpinglobals.md - - docs/models/operations/getpinrequest.md - - docs/models/operations/location.md - - docs/models/operations/getpinresponsebody.md - - docs/models/operations/getpinresponse.md - - docs/models/operations/gettokenglobals.md - - docs/models/operations/gettokenrequest.md - - docs/models/operations/gettokenlocation.md - - docs/models/operations/gettokenresponsebody.md - - docs/models/operations/gettokenresponse.md - - docs/models/operations/onlytransient.md - - docs/models/operations/getglobalhubsrequest.md - - docs/models/operations/getglobalhubsmetadata.md - - docs/models/operations/hub.md - - docs/models/operations/getglobalhubsmediacontainer.md - - docs/models/operations/getglobalhubsresponsebody.md - - docs/models/operations/getglobalhubsresponse.md - - docs/models/operations/queryparamonlytransient.md - - docs/models/operations/getlibraryhubsrequest.md - - docs/models/operations/getlibraryhubspart.md - - docs/models/operations/getlibraryhubsmedia.md - - docs/models/operations/getlibraryhubsgenre.md - - docs/models/operations/getlibraryhubscountry.md - - docs/models/operations/getlibraryhubsdirector.md - - docs/models/operations/getlibraryhubsrole.md - - docs/models/operations/getlibraryhubswriter.md - - docs/types/date.md - - docs/models/operations/getlibraryhubsmetadata.md - - docs/models/operations/getlibraryhubshub.md - - docs/models/operations/getlibraryhubsmediacontainer.md - - docs/models/operations/getlibraryhubsresponsebody.md - - docs/models/operations/getlibraryhubsresponse.md - - docs/models/operations/performsearchrequest.md - - docs/models/operations/performsearchresponse.md - - docs/models/operations/performvoicesearchrequest.md - - docs/models/operations/performvoicesearchresponse.md - - docs/models/operations/getsearchresultsrequest.md - - docs/models/operations/getsearchresultspart.md - - docs/models/operations/getsearchresultsmedia.md - - docs/models/operations/getsearchresultsgenre.md - - docs/models/operations/getsearchresultsdirector.md - - docs/models/operations/getsearchresultswriter.md - - docs/models/operations/getsearchresultscountry.md - - docs/models/operations/getsearchresultsrole.md - - docs/models/operations/getsearchresultsmetadata.md - - docs/models/operations/provider.md - - docs/models/operations/getsearchresultsmediacontainer.md - - docs/models/operations/getsearchresultsresponsebody.md - - docs/models/operations/getsearchresultsresponse.md - - docs/models/operations/getfilehashrequest.md - - docs/models/operations/getfilehashresponse.md - - docs/models/operations/part.md - - docs/models/operations/media.md - - docs/models/operations/genre.md - - docs/models/operations/director.md - - docs/models/operations/writer.md - - docs/models/operations/country.md - - docs/models/operations/role.md - - docs/models/operations/getrecentlyaddedmetadata.md - - docs/models/operations/getrecentlyaddedmediacontainer.md - - docs/models/operations/getrecentlyaddedresponsebody.md - - docs/models/operations/getrecentlyaddedresponse.md - - docs/models/operations/getlibrarieslocation.md - - docs/models/operations/getlibrariesdirectory.md - - docs/models/operations/getlibrariesmediacontainer.md - - docs/models/operations/getlibrariesresponsebody.md - - docs/models/operations/getlibrariesresponse.md - - docs/models/operations/includedetails.md - - docs/models/operations/getlibraryrequest.md - - docs/models/operations/getlibrarydirectory.md - - docs/models/operations/getlibraryfilter.md - - docs/models/operations/sort.md - - docs/models/operations/field.md - - docs/models/operations/getlibrarytype.md - - docs/models/operations/operator.md - - docs/models/operations/fieldtype.md - - docs/models/operations/getlibrarymediacontainer.md - - docs/models/operations/getlibraryresponsebody.md - - docs/models/operations/getlibraryresponse.md - - docs/models/operations/deletelibraryrequest.md - - docs/models/operations/deletelibraryresponse.md - - docs/models/operations/tag.md - - docs/models/operations/getlibraryitemsrequest.md - - docs/models/operations/librarysectionid.md - - docs/models/operations/getlibraryitemspart.md - - docs/models/operations/getlibraryitemsmedia.md - - docs/models/operations/getlibraryitemsgenre.md - - docs/models/operations/getlibraryitemscountry.md - - docs/models/operations/getlibraryitemsdirector.md - - docs/models/operations/getlibraryitemswriter.md - - docs/models/operations/getlibraryitemsrole.md - - docs/models/operations/getlibraryitemsmetadata.md - - docs/models/operations/getlibraryitemsmediacontainer.md - - docs/models/operations/getlibraryitemsresponsebody.md - - docs/models/operations/getlibraryitemsresponse.md - - docs/models/operations/refreshlibraryrequest.md - - docs/models/operations/refreshlibraryresponse.md - - docs/models/operations/type.md - - docs/models/operations/searchlibraryrequest.md - - docs/models/operations/searchlibrarymetadata.md - - docs/models/operations/searchlibrarymediacontainer.md - - docs/models/operations/searchlibraryresponsebody.md - - docs/models/operations/searchlibraryresponse.md - - docs/models/operations/getmetadatarequest.md - - docs/models/operations/stream.md - - docs/models/operations/getmetadatapart.md - - docs/models/operations/getmetadatamedia.md - - docs/models/operations/getmetadatagenre.md - - docs/models/operations/getmetadatacountry.md - - docs/models/operations/guids.md - - docs/models/operations/ratings.md - - docs/models/operations/getmetadatadirector.md - - docs/models/operations/getmetadatawriter.md - - docs/models/operations/getmetadatarole.md - - docs/models/operations/producer.md - - docs/models/operations/getmetadatametadata.md - - docs/models/operations/getmetadatamediacontainer.md - - docs/models/operations/getmetadataresponsebody.md - - docs/models/operations/getmetadataresponse.md - - docs/models/operations/getmetadatachildrenrequest.md - - docs/models/operations/getmetadatachildrendirectory.md - - docs/models/operations/getmetadatachildrenmetadata.md - - docs/models/operations/getmetadatachildrenmediacontainer.md - - docs/models/operations/getmetadatachildrenresponsebody.md - - docs/models/operations/getmetadatachildrenresponse.md - - docs/models/operations/gettopwatchedcontentrequest.md - - docs/models/operations/gettopwatchedcontentgenre.md - - docs/models/operations/gettopwatchedcontentcountry.md - - docs/models/operations/gettopwatchedcontentguids.md - - docs/models/operations/gettopwatchedcontentrole.md - - docs/models/operations/user.md - - docs/models/operations/gettopwatchedcontentmetadata.md - - docs/models/operations/gettopwatchedcontentmediacontainer.md - - docs/models/operations/gettopwatchedcontentresponsebody.md - - docs/models/operations/gettopwatchedcontentresponse.md - - docs/models/operations/getondeckstream.md - - docs/models/operations/getondeckpart.md - - docs/models/operations/getondeckmedia.md - - docs/models/operations/getondeckguids.md - - docs/models/operations/getondeckmetadata.md - - docs/models/operations/getondeckmediacontainer.md - - docs/models/operations/getondeckresponsebody.md - - docs/models/operations/getondeckresponse.md - - docs/models/operations/level.md - - docs/models/operations/loglinerequest.md - - docs/models/operations/loglineresponse.md - - docs/models/operations/logmultilineresponse.md - - docs/models/operations/enablepapertrailresponse.md - - docs/models/operations/queryparamtype.md - - docs/models/operations/smart.md - - docs/models/operations/createplaylistrequest.md - - docs/models/operations/createplaylistmetadata.md - - docs/models/operations/createplaylistmediacontainer.md - - docs/models/operations/createplaylistresponsebody.md - - docs/models/operations/createplaylistresponse.md - - docs/models/operations/playlisttype.md - - docs/models/operations/queryparamsmart.md - - docs/models/operations/getplaylistsrequest.md - - docs/models/operations/getplaylistsmetadata.md - - docs/models/operations/getplaylistsmediacontainer.md - - docs/models/operations/getplaylistsresponsebody.md - - docs/models/operations/getplaylistsresponse.md - - docs/models/operations/getplaylistrequest.md - - docs/models/operations/getplaylistmetadata.md - - docs/models/operations/getplaylistmediacontainer.md - - docs/models/operations/getplaylistresponsebody.md - - docs/models/operations/getplaylistresponse.md - - docs/models/operations/deleteplaylistrequest.md - - docs/models/operations/deleteplaylistresponse.md - - docs/models/operations/updateplaylistrequest.md - - docs/models/operations/updateplaylistresponse.md - - docs/models/operations/getplaylistcontentsrequest.md - - docs/models/operations/getplaylistcontentspart.md - - docs/models/operations/getplaylistcontentsmedia.md - - docs/models/operations/getplaylistcontentsgenre.md - - docs/models/operations/getplaylistcontentscountry.md - - docs/models/operations/getplaylistcontentsdirector.md - - docs/models/operations/getplaylistcontentswriter.md - - docs/models/operations/getplaylistcontentsrole.md - - docs/models/operations/getplaylistcontentsmetadata.md - - docs/models/operations/getplaylistcontentsmediacontainer.md - - docs/models/operations/getplaylistcontentsresponsebody.md - - docs/models/operations/getplaylistcontentsresponse.md - - docs/models/operations/clearplaylistcontentsrequest.md - - docs/models/operations/clearplaylistcontentsresponse.md - - docs/models/operations/addplaylistcontentsrequest.md - - docs/models/operations/addplaylistcontentsmetadata.md - - docs/models/operations/addplaylistcontentsmediacontainer.md - - docs/models/operations/addplaylistcontentsresponsebody.md - - docs/models/operations/addplaylistcontentsresponse.md - - docs/models/operations/force.md - - docs/models/operations/uploadplaylistrequest.md - - docs/models/operations/uploadplaylistresponse.md - - docs/models/operations/gettransienttokenqueryparamtype.md - - docs/models/operations/scope.md - - docs/models/operations/gettransienttokenrequest.md - - docs/models/operations/gettransienttokenresponse.md - - docs/models/operations/getsourceconnectioninformationrequest.md - - docs/models/operations/getsourceconnectioninformationresponse.md - - docs/models/operations/getstatisticsrequest.md - - docs/models/operations/getstatisticsdevice.md - - docs/models/operations/account.md - - docs/models/operations/statisticsmedia.md - - docs/models/operations/getstatisticsmediacontainer.md - - docs/models/operations/getstatisticsresponsebody.md - - docs/models/operations/getstatisticsresponse.md - - docs/models/operations/getresourcesstatisticsrequest.md - - docs/models/operations/statisticsresources.md - - docs/models/operations/getresourcesstatisticsmediacontainer.md - - docs/models/operations/getresourcesstatisticsresponsebody.md - - docs/models/operations/getresourcesstatisticsresponse.md - - docs/models/operations/getbandwidthstatisticsrequest.md - - docs/models/operations/getbandwidthstatisticsdevice.md - - docs/models/operations/getbandwidthstatisticsaccount.md - - docs/models/operations/statisticsbandwidth.md - - docs/models/operations/getbandwidthstatisticsmediacontainer.md - - docs/models/operations/getbandwidthstatisticsresponsebody.md - - docs/models/operations/getbandwidthstatisticsresponse.md - - docs/models/operations/getsessionsstream.md - - docs/models/operations/getsessionspart.md - - docs/models/operations/getsessionsmedia.md - - docs/models/operations/getsessionsuser.md - - docs/models/operations/player.md - - docs/models/operations/session.md - - docs/models/operations/getsessionsmetadata.md - - docs/models/operations/getsessionsmediacontainer.md - - docs/models/operations/getsessionsresponsebody.md - - docs/models/operations/getsessionsresponse.md - - docs/models/operations/filter.md - - docs/models/operations/getsessionhistoryrequest.md - - docs/models/operations/getsessionhistorymetadata.md - - docs/models/operations/getsessionhistorymediacontainer.md - - docs/models/operations/getsessionhistoryresponsebody.md - - docs/models/operations/getsessionhistoryresponse.md - - docs/models/operations/transcodesession.md - - docs/models/operations/gettranscodesessionsmediacontainer.md - - docs/models/operations/gettranscodesessionsresponsebody.md - - docs/models/operations/gettranscodesessionsresponse.md - - docs/models/operations/stoptranscodesessionrequest.md - - docs/models/operations/stoptranscodesessionresponse.md - - docs/models/operations/release.md - - docs/models/operations/getupdatestatusmediacontainer.md - - docs/models/operations/getupdatestatusresponsebody.md - - docs/models/operations/getupdatestatusresponse.md - - docs/models/operations/download.md - - docs/models/operations/checkforupdatesrequest.md - - docs/models/operations/checkforupdatesresponse.md - - docs/models/operations/tonight.md - - docs/models/operations/skip.md - - docs/models/operations/applyupdatesrequest.md - - docs/models/operations/applyupdatesresponse.md - - docs/models/operations/pathparamfilter.md - - docs/models/operations/libtype.md - - docs/models/operations/includecollections.md - - docs/models/operations/includeexternalmedia.md - - docs/models/operations/getwatchlistrequest.md - - docs/models/operations/image.md - - docs/models/operations/metadata.md - - docs/models/operations/getwatchlistresponsebody.md - - docs/models/operations/getwatchlistresponse.md - - docs/models/sdkerrors/errors.md - - docs/models/sdkerrors/getservercapabilitiesresponsebody.md - - docs/models/sdkerrors/getserverpreferenceserrors.md - - docs/models/sdkerrors/getserverpreferencesresponsebody.md - - docs/models/sdkerrors/getavailableclientserrors.md - - docs/models/sdkerrors/getavailableclientsresponsebody.md - - docs/models/sdkerrors/getdeviceserrors.md - - docs/models/sdkerrors/getdevicesresponsebody.md - - docs/models/sdkerrors/getserveridentityerrors.md - - docs/models/sdkerrors/getserveridentityresponsebody.md - - docs/models/sdkerrors/getmyplexaccounterrors.md - - docs/models/sdkerrors/getmyplexaccountresponsebody.md - - docs/models/sdkerrors/getresizedphotoerrors.md - - docs/models/sdkerrors/getresizedphotoresponsebody.md - - docs/models/sdkerrors/getserverlisterrors.md - - docs/models/sdkerrors/getserverlistresponsebody.md - - docs/models/sdkerrors/markplayederrors.md - - docs/models/sdkerrors/markplayedresponsebody.md - - docs/models/sdkerrors/markunplayederrors.md - - docs/models/sdkerrors/markunplayedresponsebody.md - - docs/models/sdkerrors/updateplayprogresserrors.md - - docs/models/sdkerrors/updateplayprogressresponsebody.md - - docs/models/sdkerrors/gettimelineerrors.md - - docs/models/sdkerrors/gettimelineresponsebody.md - - docs/models/sdkerrors/startuniversaltranscodeerrors.md - - docs/models/sdkerrors/startuniversaltranscoderesponsebody.md - - docs/models/sdkerrors/getserveractivitieserrors.md - - docs/models/sdkerrors/getserveractivitiesresponsebody.md - - docs/models/sdkerrors/cancelserveractivitieserrors.md - - docs/models/sdkerrors/cancelserveractivitiesresponsebody.md - - docs/models/sdkerrors/getbutlertaskserrors.md - - docs/models/sdkerrors/getbutlertasksresponsebody.md - - docs/models/sdkerrors/startalltaskserrors.md - - docs/models/sdkerrors/startalltasksresponsebody.md - - docs/models/sdkerrors/stopalltaskserrors.md - - docs/models/sdkerrors/stopalltasksresponsebody.md - - docs/models/sdkerrors/starttaskerrors.md - - docs/models/sdkerrors/starttaskresponsebody.md - - docs/models/sdkerrors/stoptaskerrors.md - - docs/models/sdkerrors/stoptaskresponsebody.md - - docs/models/sdkerrors/gethomedataerrors.md - - docs/models/sdkerrors/gethomedataresponsebody.md - - docs/models/sdkerrors/getpinerrors.md - - docs/models/sdkerrors/getpinresponsebody.md - - docs/models/sdkerrors/gettokenerrors.md - - docs/models/sdkerrors/gettokenresponsebody.md - - docs/models/sdkerrors/getglobalhubserrors.md - - docs/models/sdkerrors/getglobalhubsresponsebody.md - - docs/models/sdkerrors/getlibraryhubserrors.md - - docs/models/sdkerrors/getlibraryhubsresponsebody.md - - docs/models/sdkerrors/performsearcherrors.md - - docs/models/sdkerrors/performsearchresponsebody.md - - docs/models/sdkerrors/performvoicesearcherrors.md - - docs/models/sdkerrors/performvoicesearchresponsebody.md - - docs/models/sdkerrors/getsearchresultserrors.md - - docs/models/sdkerrors/getsearchresultsresponsebody.md - - docs/models/sdkerrors/getfilehasherrors.md - - docs/models/sdkerrors/getfilehashresponsebody.md - - docs/models/sdkerrors/getrecentlyaddederrors.md - - docs/models/sdkerrors/getrecentlyaddedresponsebody.md - - docs/models/sdkerrors/getlibrarieserrors.md - - docs/models/sdkerrors/getlibrariesresponsebody.md - - docs/models/sdkerrors/getlibraryerrors.md - - docs/models/sdkerrors/getlibraryresponsebody.md - - docs/models/sdkerrors/deletelibraryerrors.md - - docs/models/sdkerrors/deletelibraryresponsebody.md - - docs/models/sdkerrors/getlibraryitemserrors.md - - docs/models/sdkerrors/getlibraryitemsresponsebody.md - - docs/models/sdkerrors/refreshlibraryerrors.md - - docs/models/sdkerrors/refreshlibraryresponsebody.md - - docs/models/sdkerrors/searchlibraryerrors.md - - docs/models/sdkerrors/searchlibraryresponsebody.md - - docs/models/sdkerrors/getmetadataerrors.md - - docs/models/sdkerrors/getmetadataresponsebody.md - - docs/models/sdkerrors/getmetadatachildrenerrors.md - - docs/models/sdkerrors/getmetadatachildrenresponsebody.md - - docs/models/sdkerrors/getondeckerrors.md - - docs/models/sdkerrors/getondeckresponsebody.md - - docs/models/sdkerrors/loglineerrors.md - - docs/models/sdkerrors/loglineresponsebody.md - - docs/models/sdkerrors/logmultilineerrors.md - - docs/models/sdkerrors/logmultilineresponsebody.md - - docs/models/sdkerrors/enablepapertrailerrors.md - - docs/models/sdkerrors/enablepapertrailresponsebody.md - - docs/models/sdkerrors/createplaylisterrors.md - - docs/models/sdkerrors/createplaylistresponsebody.md - - docs/models/sdkerrors/getplaylistserrors.md - - docs/models/sdkerrors/getplaylistsresponsebody.md - - docs/models/sdkerrors/getplaylisterrors.md - - docs/models/sdkerrors/getplaylistresponsebody.md - - docs/models/sdkerrors/deleteplaylisterrors.md - - docs/models/sdkerrors/deleteplaylistresponsebody.md - - docs/models/sdkerrors/updateplaylisterrors.md - - docs/models/sdkerrors/updateplaylistresponsebody.md - - docs/models/sdkerrors/getplaylistcontentserrors.md - - docs/models/sdkerrors/getplaylistcontentsresponsebody.md - - docs/models/sdkerrors/clearplaylistcontentserrors.md - - docs/models/sdkerrors/clearplaylistcontentsresponsebody.md - - docs/models/sdkerrors/addplaylistcontentserrors.md - - docs/models/sdkerrors/addplaylistcontentsresponsebody.md - - docs/models/sdkerrors/uploadplaylisterrors.md - - docs/models/sdkerrors/uploadplaylistresponsebody.md - - docs/models/sdkerrors/gettransienttokenerrors.md - - docs/models/sdkerrors/gettransienttokenresponsebody.md - - docs/models/sdkerrors/getsourceconnectioninformationerrors.md - - docs/models/sdkerrors/getsourceconnectioninformationresponsebody.md - - docs/models/sdkerrors/getstatisticserrors.md - - docs/models/sdkerrors/getstatisticsresponsebody.md - - docs/models/sdkerrors/getresourcesstatisticserrors.md - - docs/models/sdkerrors/getresourcesstatisticsresponsebody.md - - docs/models/sdkerrors/getbandwidthstatisticserrors.md - - docs/models/sdkerrors/getbandwidthstatisticsresponsebody.md - - docs/models/sdkerrors/getsessionserrors.md - - docs/models/sdkerrors/getsessionsresponsebody.md - - docs/models/sdkerrors/getsessionhistoryerrors.md - - docs/models/sdkerrors/getsessionhistoryresponsebody.md - - docs/models/sdkerrors/gettranscodesessionserrors.md - - docs/models/sdkerrors/gettranscodesessionsresponsebody.md - - docs/models/sdkerrors/stoptranscodesessionerrors.md - - docs/models/sdkerrors/stoptranscodesessionresponsebody.md - - docs/models/sdkerrors/getupdatestatuserrors.md - - docs/models/sdkerrors/getupdatestatusresponsebody.md - - docs/models/sdkerrors/checkforupdateserrors.md - - docs/models/sdkerrors/checkforupdatesresponsebody.md - - docs/models/sdkerrors/applyupdateserrors.md - - docs/models/sdkerrors/applyupdatesresponsebody.md - - docs/models/sdkerrors/getwatchlisterrors.md - - docs/models/sdkerrors/getwatchlistresponsebody.md - - docs/models/components/security.md - - docs/sdks/plexapi/README.md - - docs/sdks/server/README.md - - docs/sdks/media/README.md - - docs/sdks/video/README.md - - docs/sdks/activities/README.md - - docs/sdks/butler/README.md - - docs/models/operations/option.md - - docs/sdks/plex/README.md - - docs/sdks/hubs/README.md - - docs/sdks/search/README.md - - docs/sdks/library/README.md - - docs/sdks/log/README.md - - docs/sdks/playlists/README.md - - docs/sdks/authentication/README.md - - docs/sdks/statistics/README.md - - docs/sdks/sessions/README.md - - docs/sdks/updater/README.md - - docs/sdks/watchlist/README.md - - USAGE.md + - library.go + - log.go + - media.go - models/operations/options.go - - .gitattributes - - internal/hooks/hooks.go + - models/sdkerrors/sdkerror.go + - playlists.go + - plex.go + - plexapi.go + - retry/config.go + - search.go + - server.go + - sessions.go + - statistics.go + - types/bigint.go + - types/date.go + - types/datetime.go + - types/decimal.go + - types/pointers.go + - updater.go + - video.go + - watchlist.go +examples: + getServerCapabilities: + speakeasy-default-get-server-capabilities: + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getServerPreferences: + speakeasy-default-get-server-preferences: + responses: + "200": + application/json: {"MediaContainer": {"size": 161, "Setting": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getAvailableClients: + speakeasy-default-get-available-clients: + responses: + "200": + application/json: {"MediaContainer": {"size": 1, "Server": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getDevices: + speakeasy-default-get-devices: + responses: + "200": + application/json: {"MediaContainer": {"size": 151, "identifier": "com.plexapp.system.devices", "Device": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-server-identity: + speakeasy-default-get-server-identity: + responses: + "200": + application/json: {"MediaContainer": {"size": 0, "machineIdentifier": "96f2fe7a78c9dc1f16a16bedbe90f98149be16b4", "version": "1.31.3.6868-28fc46b27"}} + "408": + application/json: {"code": 408, "message": "The server timed out waiting for the request."} + getMyPlexAccount: + speakeasy-default-get-my-plex-account: + responses: + "200": + application/json: {"MyPlex": {"authToken": "Z5v-PrNASDFpsaCi3CPK7", "username": "example.email@mail.com", "mappingState": "mapped", "signInState": "ok", "publicAddress": "140.20.68.140", "publicPort": 32400, "privateAddress": "10.10.10.47", "privatePort": 32400, "subscriptionFeatures": "federated-auth,hardware_transcoding,home,hwtranscode,item_clusters,kevin-bacon,livetv,loudness,lyrics,music-analysis,music_videos,pass,photo_autotags,photos-v5,photosV6-edit,photosV6-tv-albums,premium_music_metadata,radio,server-manager,session_bandwidth_restrictions,session_kick,shared-radio,sync,trailers,tuner-sharing,type-first,unsupportedtuners,webhooks", "subscriptionState": "Active"}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getResizedPhoto: + speakeasy-default-get-resized-photo: + parameters: + query: + width: 110 + height: 165 + opacity: 100 + blur: 20 + minSize: 1 + upscale: 0 + url: "/library/metadata/49564/thumb/1654258204" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-media-providers: + speakeasy-default-get-media-providers: + parameters: + query: + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getServerList: + speakeasy-default-get-server-list: + responses: + "200": + application/json: {"MediaContainer": {"size": 1, "Server": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + markPlayed: + speakeasy-default-mark-played: + parameters: + query: + key: 59398 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + markUnplayed: + speakeasy-default-mark-unplayed: + parameters: + query: + key: 59398 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + updatePlayProgress: + "": + parameters: + query: + key: "" + time: 90000 + state: "played" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-banner-image: + speakeasy-default-get-banner-image: + parameters: + path: + ratingKey: 9518 + query: + width: 396 + height: 396 + minSize: 1 + upscale: 1 + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-thumb-image: + speakeasy-default-get-thumb-image: + parameters: + path: + ratingKey: 9518 + query: + width: 396 + height: 396 + minSize: 1 + upscale: 1 + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getTimeline: + "": + parameters: + query: + ratingKey: 23409 + key: "/library/metadata/23409" + state: "playing" + hasMDE: 1 + time: 2000 + duration: 10000 + context: "home:hub.continueWatching" + playQueueItemID: 1 + playBackTime: 2000 + row: 1 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + startUniversalTranscode: + "": + parameters: + query: + hasMDE: 1 + path: "/library/metadata/23409" + mediaIndex: 0 + partIndex: 0 + protocol: "hls" + fastSeek: 0 + directPlay: 0 + directStream: 0 + subtitleSize: 100 + subtites: "burn" + audioBoost: 100 + location: "lan" + mediaBufferSize: 102400 + session: "zvcage8b7rkioqcm8f4uns4c" + addDebugOverlay: 0 + autoAdjustQuality: 0 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getServerActivities: + speakeasy-default-get-server-activities: + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + cancelServerActivities: + "": + parameters: + path: + activityUUID: "25b71ed5-0f9d-461c-baa7-d404e9e10d3e" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getButlerTasks: + speakeasy-default-get-butler-tasks: + responses: + "200": + application/json: {"ButlerTasks": {"ButlerTask": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + startAllTasks: + speakeasy-default-start-all-tasks: + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + stopAllTasks: + speakeasy-default-stop-all-tasks: + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + startTask: + speakeasy-default-start-task: + parameters: + path: + taskName: "CleanOldBundles" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + stopTask: + speakeasy-default-stop-task: + parameters: + path: + taskName: "BackupDatabase" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getCompanionsData: + speakeasy-default-get-companions-data: + responses: + "200": + application/json: [] + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getUserFriends: + speakeasy-default-get-user-friends: + responses: + "200": + application/json: [{"email": "username@email.com", "friendlyName": "exampleUser", "home": true, "id": 0, "restricted": false, "sharedServers": [], "sharedSources": [], "status": "accepted", "thumb": "https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578", "title": "username123", "username": "username123", "uuid": "7d1916e0d8f6e76b"}] + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getGeoData: + speakeasy-default-get-geo-data: + responses: + "200": + application/json: {"code": "VI", "continent_code": "NA", "country": "United States Virgin Islands", "city": "Amsterdam", "european_union_member": true, "time_zone": "America/St_Thomas", "postal_code": 802, "in_privacy_restricted_country": true, "in_privacy_restricted_region": true, "subdivisions": "Saint Thomas", "coordinates": "18.3381, -64.8941"} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getHomeData: + speakeasy-default-get-home-data: + responses: + "200": + application/json: {"id": 1841489, "name": "Blindkitty38's home", "guestUserID": 58815432, "guestUserUUID": "f3df4e01bfca0787"} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-server-resources: + speakeasy-default-get-server-resources: + parameters: + query: + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + includeHttps: 1 + includeRelay: 1 + includeIPv6: 1 + responses: + "200": + application/json: [] + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getPin: + "": + parameters: + query: + X-Plex-Product: "Plex Web" + responses: + "200": + application/json: {"id": 308667304, "code": "7RQZ", "product": "0", "trusted": false, "qr": "https://plex.tv/api/v2/pins/qr/7RQZ", "clientIdentifier": "string", "location": {"code": "VI", "continent_code": "NA", "country": "United States Virgin Islands", "city": "Amsterdam", "european_union_member": true, "time_zone": "America/St_Thomas", "postal_code": 802, "in_privacy_restricted_country": true, "in_privacy_restricted_region": true, "subdivisions": "Saint Thomas", "coordinates": "18.3381, -64.8941"}, "expiresIn": 876, "createdAt": "2024-07-16T17:03:05Z", "expiresAt": "2024-07-16T17:18:05Z", "authToken": null, "newRegistration": null} + "400": + application/json: {"errors": []} + getTokenByPinId: + "": + parameters: + path: + pinID: 408895 + query: {} + responses: + "404": + application/json: {"errors": [{"code": 1020, "message": "Code not found or expired"}]} + getGlobalHubs: + speakeasy-default-get-global-hubs: + responses: + "200": + application/json: {"MediaContainer": {"size": 8, "allowSync": true, "identifier": "com.plexapp.plugins.library", "Hub": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getLibraryHubs: + speakeasy-default-get-library-hubs: + parameters: + path: + sectionId: "6728.76" + query: {} + responses: + "200": + application/json: {"MediaContainer": {"size": 7, "allowSync": true, "identifier": "com.plexapp.plugins.library", "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionUUID": "322a231a-b7f7-49f5-920f-14c61199cd30", "Hub": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + performSearch: + speakeasy-default-perform-search: + parameters: + query: + query: "dylan" + limit: 5 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + performVoiceSearch: + speakeasy-default-perform-voice-search: + parameters: + query: + query: "dead+poop" + limit: 5 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getSearchResults: + speakeasy-default-get-search-results: + parameters: + query: + query: "110" + responses: + "200": + application/json: {"MediaContainer": {"size": 26, "identifier": "com.plexapp.plugins.library", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1680021154, "Metadata": [], "Provider": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getFileHash: + speakeasy-default-get-file-hash: + parameters: + query: + url: "file://C:\\Image.png&type=13" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getRecentlyAdded: + speakeasy-default-get-recently-added: + parameters: + query: + X-Plex-Container-Start: 0 + X-Plex-Container-Size: 50 + responses: + "200": + application/json: {"MediaContainer": {"size": 50, "identifier": "com.plexapp.plugins.library", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1680021154, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-all-libraries: + speakeasy-default-get-all-libraries: + responses: + "200": + application/json: {"MediaContainer": {"size": 5, "allowSync": false, "title1": "Plex Library", "Directory": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-library-details: + speakeasy-default-get-library-details: + parameters: + path: + sectionKey: 9518 + query: {} + responses: + "200": + application/json: {"MediaContainer": {"size": 29, "allowSync": false, "art": "/:/resources/movie-fanart.jpg", "content": "secondary", "identifier": "com.plexapp.plugins.library", "librarySectionID": 1, "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1701731894, "thumb": "/:/resources/movie.png", "title1": "Movies", "viewGroup": "secondary", "viewMode": 65592, "Directory": [], "Type": [], "FieldType": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + deleteLibrary: + speakeasy-default-delete-library: + parameters: + path: + sectionKey: 9518 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-library-items: + "": + parameters: + path: + sectionKey: 9518 + tag: "edition" + query: + includeGuids: 1 + includeMeta: 1 + type: 2 + X-Plex-Container-Start: 0 + X-Plex-Container-Size: 50 + responses: + "200": + application/json: {"MediaContainer": {"size": 70, "allowSync": true, "art": "/:/resources/movie-fanart.jpg", "identifier": "com.plexapp.plugins.library", "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": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-refresh-library-metadata: + speakeasy-default-get-refresh-library-metadata: + parameters: + path: + sectionKey: 9518 + query: + force: 0 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-search-library: + speakeasy-default-get-search-library: + parameters: + path: + sectionKey: 9518 + query: + type: 2 + responses: + "200": + application/json: {"MediaContainer": {"size": 2, "allowSync": false, "art": "/:/resources/show-fanart.jpg", "identifier": "com.plexapp.plugins.library", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1698860922, "nocache": true, "thumb": "/:/resources/show.png", "title1": "TV Shows", "title2": "Search for ''", "viewGroup": "season", "viewMode": 65593, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-meta-data-by-rating-key: + speakeasy-default-get-meta-data-by-rating-key: + parameters: + path: + ratingKey: 9518 + responses: + "200": + application/json: {"MediaContainer": {"size": 1, "allowSync": true, "identifier": "com.plexapp.plugins.library", "librarySectionID": 1, "librarySectionTitle": "Movies", "librarySectionUUID": "cfc899d7-3000-46f6-8489-b9592714ada5", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1698860922, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getMetadataChildren: + include-stream: + parameters: + path: + ratingKey: "1539.14" + query: + includeElements: "Stream" + responses: + "200": + application/json: {"MediaContainer": {"size": 3, "allowSync": true, "art": "/library/metadata/30072/art/1705739923", "identifier": "com.plexapp.plugins.library", "key": "30072", "librarySectionID": 2, "librarySectionTitle": "TV Shows", "librarySectionUUID": "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1701731894, "nocache": true, "parentIndex": 1, "parentTitle": "Reacher", "parentYear": 2022, "summary": "When retired Military Police Officer Jack Reacher is arrested for a murder he did not commit, he finds himself in the middle of a deadly conspiracy full of dirty cops, shady businessmen, and scheming politicians. With nothing but his wits, he must figure out what is happening in Margrave, Georgia.", "theme": "/library/metadata/30072/theme/1705739923", "thumb": "/library/metadata/30072/thumb/1705739923", "title1": "TV Shows", "title2": "Reacher", "viewGroup": "season", "viewMode": 65593, "Directory": [{"leafCount": 16, "thumb": "/library/metadata/30072/thumb/1705739923", "viewedLeafCount": 16, "key": "/library/metadata/30072/allLeaves", "title": "All episodes"}], "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + include-stream-otheritem: + parameters: + path: + ratingKey: "8449.64" + query: + includeElements: "Stream,OtherItem" + responses: + "200": + application/json: {"MediaContainer": {"size": 3, "allowSync": true, "art": "/library/metadata/30072/art/1705739923", "identifier": "com.plexapp.plugins.library", "key": "30072", "librarySectionID": 2, "librarySectionTitle": "TV Shows", "librarySectionUUID": "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1701731894, "nocache": true, "parentIndex": 1, "parentTitle": "Reacher", "parentYear": 2022, "summary": "When retired Military Police Officer Jack Reacher is arrested for a murder he did not commit, he finds himself in the middle of a deadly conspiracy full of dirty cops, shady businessmen, and scheming politicians. With nothing but his wits, he must figure out what is happening in Margrave, Georgia.", "theme": "/library/metadata/30072/theme/1705739923", "thumb": "/library/metadata/30072/thumb/1705739923", "title1": "TV Shows", "title2": "Reacher", "viewGroup": "season", "viewMode": 65593, "Directory": [{"leafCount": 16, "thumb": "/library/metadata/30072/thumb/1705739923", "viewedLeafCount": 16, "key": "/library/metadata/30072/allLeaves", "title": "All episodes"}], "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + include-stream-otheritem-anotheritem: + parameters: + path: + ratingKey: "5800.4" + query: + includeElements: "Stream,OtherItem,AnotherItem" + responses: + "200": + application/json: {"MediaContainer": {"size": 3, "allowSync": true, "art": "/library/metadata/30072/art/1705739923", "identifier": "com.plexapp.plugins.library", "key": "30072", "librarySectionID": 2, "librarySectionTitle": "TV Shows", "librarySectionUUID": "4bb2521c-8ba9-459b-aaee-8ab8bc35eabd", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1701731894, "nocache": true, "parentIndex": 1, "parentTitle": "Reacher", "parentYear": 2022, "summary": "When retired Military Police Officer Jack Reacher is arrested for a murder he did not commit, he finds himself in the middle of a deadly conspiracy full of dirty cops, shady businessmen, and scheming politicians. With nothing but his wits, he must figure out what is happening in Margrave, Georgia.", "theme": "/library/metadata/30072/theme/1705739923", "thumb": "/library/metadata/30072/thumb/1705739923", "title1": "TV Shows", "title2": "Reacher", "viewGroup": "season", "viewMode": 65593, "Directory": [{"leafCount": 16, "thumb": "/library/metadata/30072/thumb/1705739923", "viewedLeafCount": 16, "key": "/library/metadata/30072/allLeaves", "title": "All episodes"}], "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getTopWatchedContent: + "": + parameters: + query: + type: 2 + includeGuids: 1 + responses: + "200": + application/json: {"MediaContainer": {"size": 1, "allowSync": true, "identifier": "com.plexapp.plugins.library", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1698860922, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getOnDeck: + speakeasy-default-get-on-deck: + responses: + "200": + application/json: {"MediaContainer": {"size": 16, "identifier": "com.plexapp.plugins.library", "mediaTagPrefix": "/system/bundle/media/flags/", "mediaTagVersion": 1680021154, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + get-watch-list: + speakeasy-default-get-watch-list: + parameters: + path: + filter: "available" + query: + X-Plex-Container-Start: 0 + X-Plex-Container-Size: 50 + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + logLine: + speakeasy-default-log-line: + parameters: + query: + level: 3 + message: "Test log message" + source: "Postman" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + logMultiLine: + speakeasy-default-log-multi-line: + requestBody: + text/plain: "level=4&message=Test%20message%201&source=postman\nlevel=3&message=Test%20message%202&source=postman\nlevel=1&message=Test%20message%203&source=postman" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + enablePaperTrail: + speakeasy-default-enable-paper-trail: + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + createPlaylist: + speakeasy-default-create-playlist: + parameters: + query: + title: "" + type: "photo" + smart: 1 + uri: "https://inborn-brochure.biz" + responses: + "200": + application/json: {"MediaContainer": {"size": 7, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getPlaylists: + speakeasy-default-get-playlists: + responses: + "200": + application/json: {"MediaContainer": {"size": 4, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getPlaylist: + speakeasy-default-get-playlist: + parameters: + path: + playlistID: "4109.48" + responses: + "200": + application/json: {"MediaContainer": {"size": 1, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + deletePlaylist: + speakeasy-default-delete-playlist: + parameters: + path: + playlistID: "216.22" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + updatePlaylist: + speakeasy-default-update-playlist: + parameters: + path: + playlistID: "3915" + query: {} + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getPlaylistContents: + speakeasy-default-get-playlist-contents: + parameters: + path: + playlistID: "5004.46" + query: + type: 2 + responses: + "200": + application/json: {"MediaContainer": {"size": 2, "composite": "/playlists/95/composite/1705717521", "duration": 282, "leafCount": 2, "playlistType": "video", "ratingKey": "95", "smart": true, "title": "Smart Movie Playlist", "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + clearPlaylistContents: + speakeasy-default-clear-playlist-contents: + parameters: + path: + playlistID: "1893.18" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + addPlaylistContents: + speakeasy-default-add-playlist-contents: + parameters: + path: + playlistID: "8502.01" + query: + uri: "server://12345/com.plexapp.plugins.library/library/metadata/1" + playQueueID: 123 + responses: + "200": + application/json: {"MediaContainer": {"size": 1, "leafCountAdded": 1, "leafCountRequested": 1, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + uploadPlaylist: + speakeasy-default-upload-playlist: + parameters: + query: + path: "/home/barkley/playlist.m3u" + force: 0 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getTransientToken: + speakeasy-default-get-transient-token: + parameters: + query: + type: "delegation" + scope: "all" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getSourceConnectionInformation: + speakeasy-default-get-source-connection-information: + parameters: + query: + source: "server://client-identifier" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getUserDetails: + speakeasy-default-get-user-details: + parameters: + query: + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + responses: + "200": + application/json: {"adsConsent": true, "adsConsentReminderAt": "2019-08-24T14:15:22Z", "adsConsentSetAt": "2019-08-24T14:15:22Z", "anonymous": false, "authToken": "CxoUzBTSV5hsxjTpFKaf", "backupCodesCreated": false, "confirmed": false, "country": "US", "email": "username@email.com", "emailOnlyAuth": false, "experimentalFeatures": false, "friendlyName": "friendlyUsername", "entitlements": [], "guest": false, "hasPassword": true, "home": false, "homeAdmin": false, "homeSize": 1, "id": 13692262, "joinedAt": 1721154902, "locale": null, "mailingListActive": false, "mailingListStatus": "unsubscribed", "maxHomeSize": 15, "pin": "string", "profile": {"autoSelectAudio": true, "defaultAudioLanguage": "ja", "defaultSubtitleLanguage": "en", "autoSelectSubtitle": "1", "defaultSubtitleAccessibility": "1", "defaultSubtitleForced": "0", "watchedIndicator": "1", "mediaReviewsVisibility": 0}, "protected": false, "rememberExpiresAt": 1722364046, "restricted": false, "roles": ["string"], "scrobbleTypes": "", "services": [{"identifier": "metadata-dev", "endpoint": "https://epg.provider.plex.tv", "token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", "secret": "string", "status": "online"}], "subscription": {"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}, "subscriptionDescription": "string", "subscriptions": [{"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}], "thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", "title": "UsernameTitle", "twoFactorEnabled": false, "username": "Username", "uuid": "dae343c1f45beb4f"} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + post-users-sign-in-data: + speakeasy-default-post-users-sign-in-data: + requestBody: + application/x-www-form-urlencoded: {"login": "username@email.com", "password": "password123", "verificationCode": "123456"} + responses: + "201": + application/json: {"adsConsent": true, "adsConsentReminderAt": "2019-08-24T14:15:22Z", "adsConsentSetAt": "2019-08-24T14:15:22Z", "anonymous": false, "authToken": "CxoUzBTSV5hsxjTpFKaf", "backupCodesCreated": false, "confirmed": false, "country": "US", "email": "username@email.com", "emailOnlyAuth": false, "experimentalFeatures": false, "friendlyName": "friendlyUsername", "entitlements": [], "guest": false, "hasPassword": true, "home": false, "homeAdmin": false, "homeSize": 1, "id": 13692262, "joinedAt": 1721154902, "locale": null, "mailingListActive": false, "mailingListStatus": "unsubscribed", "maxHomeSize": 15, "pin": "string", "profile": {"autoSelectAudio": true, "defaultAudioLanguage": "ja", "defaultSubtitleLanguage": "en", "autoSelectSubtitle": "1", "defaultSubtitleAccessibility": "1", "defaultSubtitleForced": "0", "watchedIndicator": "1", "mediaReviewsVisibility": 0}, "protected": false, "rememberExpiresAt": 1722364046, "restricted": false, "roles": ["string"], "scrobbleTypes": "", "services": [{"identifier": "metadata-dev", "endpoint": "https://epg.provider.plex.tv", "token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", "secret": "string", "status": "online"}], "subscription": {"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}, "subscriptionDescription": "string", "subscriptions": [{"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}], "thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", "title": "UsernameTitle", "twoFactorEnabled": false, "username": "Username", "uuid": "dae343c1f45beb4f", "pastSubscriptions": [{"id": "string", "mode": "string", "renewsAt": "string", "endsAt": "1556281940", "canceled": "0", "gracePeriod": "0", "onHold": "0", "canReactivate": "0", "canUpgrade": "0", "canDowngrade": "0", "canConvert": "0", "type": "plexpass", "transfer": "string", "state": "ended", "billing": {"paymentMethodId": 569045}}], "trials": [{}]} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getStatistics: + "": + parameters: + query: + Timespan: 4 + responses: + "200": + application/json: {"MediaContainer": {"size": 5497, "Device": [], "Account": [], "StatisticsMedia": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getResourcesStatistics: + "": + parameters: + query: + Timespan: 4 + responses: + "200": + application/json: {"MediaContainer": {"size": 5497, "StatisticsResources": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getBandwidthStatistics: + "": + parameters: + query: + Timespan: 4 + responses: + "200": + application/json: {"MediaContainer": {"size": 5497, "Device": [], "Account": [], "StatisticsBandwidth": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getSessions: + speakeasy-default-get-sessions: + responses: + "200": + application/json: {"MediaContainer": {"size": 1, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getSessionHistory: + viewed-at-descending: + parameters: + query: + sort: "viewedAt:desc" + accountId: 1 + librarySectionID: 12 + responses: + "200": + application/json: {"MediaContainer": {"size": 10855, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + viewed-at-ascending: + parameters: + query: + sort: "viewedAt:asc" + accountId: 1 + librarySectionID: 12 + responses: + "200": + application/json: {"MediaContainer": {"size": 10855, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + rating-descending: + parameters: + query: + sort: "rating:desc" + accountId: 1 + librarySectionID: 12 + responses: + "200": + application/json: {"MediaContainer": {"size": 10855, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + rating-ascending: + parameters: + query: + sort: "rating:asc" + accountId: 1 + librarySectionID: 12 + responses: + "200": + application/json: {"MediaContainer": {"size": 10855, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + "": + parameters: + query: + accountId: 1 + librarySectionID: 12 + responses: + "200": + application/json: {"MediaContainer": {"size": 10855, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + ViewedAt: + parameters: + query: + accountId: 1 + filter: viewedAt>=1704862818 + librarySectionID: 12 + responses: + "200": + application/json: {"MediaContainer": {"size": 10855, "Metadata": []}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getTranscodeSessions: + speakeasy-default-get-transcode-sessions: + responses: + "200": + application/json: {"MediaContainer": {"size": 1, "TranscodeSession": [{"key": "vv3i2q2lax92qlzul1hbd4bx", "throttled": false, "complete": false, "progress": 1.7999999523162842, "size": -22, "speed": 25.100000381469727, "error": false, "duration": 1445695, "remaining": 53, "context": "streaming", "sourceVideoCodec": "h264", "sourceAudioCodec": "aac", "videoDecision": "transcode", "audioDecision": "transcode", "subtitleDecision": "burn", "protocol": "http", "container": "mkv", "videoCodec": "h264", "audioCodec": "opus", "audioChannels": 1, "transcodeHwRequested": true, "timeStamp": 1705895805.4919229, "maxOffsetAvailable": 29.53, "minOffsetAvailable": 3.003000020980835}]}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + stopTranscodeSession: + speakeasy-default-stop-transcode-session: + parameters: + path: + sessionKey: "zz7llzqlx8w9vnrsbnwhbmep" + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + getUpdateStatus: + speakeasy-default-get-update-status: + responses: + "200": + application/json: {"MediaContainer": {"size": 1, "canInstall": false, "checkedAt": 1705801232, "downloadURL": "https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx", "status": 0, "Release": [{"key": "https://plex.tv/updater/releases/5136", "version": "1.40.0.7775-456fbaf97", "added": "(PLEASE NOTE) This version makes changes to the database which will make it compatible only with server versions 1.31.2 or higher (released March 14). You will not be able to use your database on Plex Media Server versions lower than this after this update. Please also be patient when updating to this version if you have a very large database and allow the upgrade process to finish.\n(Collections) Items added to a collection from the item context menu will now lock the collection field on the items (#12793)\n(Music) Store track genres and add filtering options (#14653)\n(Music) Support ID3v2.4 null-separated tags for genres and release type (#14653)\n(View History) No longer create a view history entry for items marked as played (#10888)\n(Web) Updated to 4.118.0", "fixed": "(Agents) Changing a 'Other Videos' type library to the modern movie agent would fail (#14483)\n(Agents) It is possible that agents are not initialised during startup on rare occasions (#14654)\n(Agents) Remove the legacy OpenSubtitles agent which is no longer supported upstream (#14667)\n(Collection) Server could become unresponsive when collection membership changes (#14612)\n(DVR) Previously watched recordings could be deleted without being watched again (#13779)\n(Libraries) When performing fix match on items from certain music libraries the language would default to Arabic (#14501)\n(Library) The Content Rating not equal to None filter does not work (#14620)\n(Search) Album search results could contain all the album's tracks too (#14486)\n(Subtitles) In some circumstances, sidecar subtitles can show up for media when they're no longer available (#14674)\n(Transcoder) HW encoding would fail on devices with no rate control (#14222)\n(Transcoder) Software transcoding on Ubuntu could cause unexpected behavior (#14605)", "downloadURL": "https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx", "state": "notify"}]}} + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + checkForUpdates: + "": + parameters: + query: + download: 1 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} + applyUpdates: + "": + parameters: + query: + tonight: 1 + skip: 1 + responses: + "400": + application/json: {"errors": []} + "401": + application/json: {"errors": []} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 92ff6f9..8c8b92e 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true go: - version: 0.10.1 + version: 0.11.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 46b3578..a5e4342 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,30 +1,27 @@ -speakeasyVersion: 1.323.0 +speakeasyVersion: 1.393.0 sources: my-source: sourceNamespace: my-source - sourceRevisionDigest: sha256:ff9779ff7b4bdff35d146a962e94b766578532ac129d6adff9883756f1e4e8ed - sourceBlobDigest: sha256:f5d953ec4a6fb0e4fc2a8fa79009d6d5c818c97394020a744172870ea27a0e32 + sourceRevisionDigest: sha256:44184fe64938a688d21d58aa0e390471812eda6f10c9ca0145a7328cf31a4f0a + sourceBlobDigest: sha256:7257c51225e1fb6fa7de445fbe2f31151dc89771894c9b731a29ab01b504f503 tags: - latest - - main targets: plexgo: source: my-source sourceNamespace: my-source - sourceRevisionDigest: sha256:ff9779ff7b4bdff35d146a962e94b766578532ac129d6adff9883756f1e4e8ed - sourceBlobDigest: sha256:f5d953ec4a6fb0e4fc2a8fa79009d6d5c818c97394020a744172870ea27a0e32 + sourceRevisionDigest: sha256:44184fe64938a688d21d58aa0e390471812eda6f10c9ca0145a7328cf31a4f0a + sourceBlobDigest: sha256:7257c51225e1fb6fa7de445fbe2f31151dc89771894c9b731a29ab01b504f503 codeSamplesNamespace: code-samples-go-plexgo - codeSamplesRevisionDigest: sha256:2ba78526af38dcbc157c79a2ffe44ed0a6746610f0fa145e806ad99d3f45dacb - outLocation: /github/workspace/repo + codeSamplesRevisionDigest: sha256:b29eb2b86eda1395b8ef060fcde42040e9f2865d4212aaa69ec7d96597da23c5 + outLocation: /home/luke/github/plexgo workflow: workflowVersion: 1.0.0 speakeasyVersion: latest sources: my-source: inputs: - - location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/plex-media-server-spec-dereferenced.yaml - registry: - location: registry.speakeasyapi.dev/lukehagar/lukehagar/my-source + - location: registry.speakeasyapi.dev/lukehagar/lukehagar/plex-api:main targets: plexgo: target: go diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 07aedb3..dd78905 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -3,9 +3,7 @@ speakeasyVersion: latest sources: my-source: inputs: - - location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/plex-media-server-spec-dereferenced.yaml - registry: - location: registry.speakeasyapi.dev/lukehagar/lukehagar/my-source + - location: registry.speakeasyapi.dev/lukehagar/lukehagar/plex-api:main targets: plexgo: target: go diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d585717 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,26 @@ +# Contributing to This Repository + +Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. + +## How to Report Issues + +If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: + +- A clear and descriptive title +- Steps to reproduce the issue +- Expected and actual behavior +- Any relevant logs, screenshots, or error messages +- Information about your environment (e.g., operating system, software versions) + - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed + +## Issue Triage and Upstream Fixes + +We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. + +## Contact + +If you have any questions or need further assistance, please feel free to reach out by opening an issue. + +Thank you for your understanding and cooperation! + +The Maintainers diff --git a/README.md b/README.md index a4a0764..9f59cda 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,31 @@ + +## Summary + +Plex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server + + + +## Table of Contents + +* [SDK Installation](#sdk-installation) +* [SDK Example Usage](#sdk-example-usage) +* [Available Resources and Operations](#available-resources-and-operations) +* [Global Parameters](#global-parameters) +* [Retries](#retries) +* [Error Handling](#error-handling) +* [Server Selection](#server-selection) +* [Custom HTTP Client](#custom-http-client) +* [Authentication](#authentication) +* [Special Types](#special-types) + + ## SDK Installation +To add the SDK as a dependency to your project: ```bash go get github.com/LukeHagar/plexgo ``` @@ -32,7 +54,7 @@ import ( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -60,6 +82,7 @@ func main() { * [GetServerIdentity](docs/sdks/server/README.md#getserveridentity) - Get Server Identity * [GetMyPlexAccount](docs/sdks/server/README.md#getmyplexaccount) - Get MyPlex Account * [GetResizedPhoto](docs/sdks/server/README.md#getresizedphoto) - Get a Resized Photo +* [GetMediaProviders](docs/sdks/server/README.md#getmediaproviders) - Get Media Providers * [GetServerList](docs/sdks/server/README.md#getserverlist) - Get Server List ### [Media](docs/sdks/media/README.md) @@ -67,6 +90,8 @@ func main() { * [MarkPlayed](docs/sdks/media/README.md#markplayed) - Mark Media Played * [MarkUnplayed](docs/sdks/media/README.md#markunplayed) - Mark Media Unplayed * [UpdatePlayProgress](docs/sdks/media/README.md#updateplayprogress) - Update Media Play Progress +* [GetBannerImage](docs/sdks/media/README.md#getbannerimage) - Get Banner Image +* [GetThumbImage](docs/sdks/media/README.md#getthumbimage) - Get Thumb Image ### [Video](docs/sdks/video/README.md) @@ -88,9 +113,13 @@ func main() { ### [Plex](docs/sdks/plex/README.md) +* [GetCompanionsData](docs/sdks/plex/README.md#getcompanionsdata) - Get Companions Data +* [GetUserFriends](docs/sdks/plex/README.md#getuserfriends) - Get list of friends of the user logged in +* [GetGeoData](docs/sdks/plex/README.md#getgeodata) - Get Geo Data * [GetHomeData](docs/sdks/plex/README.md#gethomedata) - Get Plex Home Data +* [GetServerResources](docs/sdks/plex/README.md#getserverresources) - Get Server Resources * [GetPin](docs/sdks/plex/README.md#getpin) - Get a Pin -* [GetToken](docs/sdks/plex/README.md#gettoken) - Get Access Token +* [GetTokenByPinID](docs/sdks/plex/README.md#gettokenbypinid) - Get Access Token by PinId ### [Hubs](docs/sdks/hubs/README.md) @@ -107,17 +136,21 @@ func main() { * [GetFileHash](docs/sdks/library/README.md#getfilehash) - Get Hash Value * [GetRecentlyAdded](docs/sdks/library/README.md#getrecentlyadded) - Get Recently Added -* [GetLibraries](docs/sdks/library/README.md#getlibraries) - Get All Libraries -* [GetLibrary](docs/sdks/library/README.md#getlibrary) - Get Library Details +* [GetAllLibraries](docs/sdks/library/README.md#getalllibraries) - Get All Libraries +* [GetLibraryDetails](docs/sdks/library/README.md#getlibrarydetails) - Get Library Details * [DeleteLibrary](docs/sdks/library/README.md#deletelibrary) - Delete Library Section * [GetLibraryItems](docs/sdks/library/README.md#getlibraryitems) - Get Library Items -* [RefreshLibrary](docs/sdks/library/README.md#refreshlibrary) - Refresh Library -* [SearchLibrary](docs/sdks/library/README.md#searchlibrary) - Search Library -* [GetMetadata](docs/sdks/library/README.md#getmetadata) - Get Items Metadata +* [GetRefreshLibraryMetadata](docs/sdks/library/README.md#getrefreshlibrarymetadata) - Refresh Metadata Of The Library +* [GetSearchLibrary](docs/sdks/library/README.md#getsearchlibrary) - Search Library +* [GetMetaDataByRatingKey](docs/sdks/library/README.md#getmetadatabyratingkey) - Get Metadata by RatingKey * [GetMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children * [GetTopWatchedContent](docs/sdks/library/README.md#gettopwatchedcontent) - Get Top Watched Content * [GetOnDeck](docs/sdks/library/README.md#getondeck) - Get On Deck +### [Watchlist](docs/sdks/watchlist/README.md) + +* [GetWatchList](docs/sdks/watchlist/README.md#getwatchlist) - Get User Watchlist + ### [Log](docs/sdks/log/README.md) * [LogLine](docs/sdks/log/README.md#logline) - Logging a single line message. @@ -140,6 +173,8 @@ func main() { * [GetTransientToken](docs/sdks/authentication/README.md#gettransienttoken) - Get a Transient Token. * [GetSourceConnectionInformation](docs/sdks/authentication/README.md#getsourceconnectioninformation) - Get Source Connection Information +* [GetUserDetails](docs/sdks/authentication/README.md#getuserdetails) - Get User Data By Token +* [PostUsersSignInData](docs/sdks/authentication/README.md#postuserssignindata) - Get User Sign In Data ### [Statistics](docs/sdks/statistics/README.md) @@ -159,21 +194,104 @@ func main() { * [GetUpdateStatus](docs/sdks/updater/README.md#getupdatestatus) - Querying status of updates * [CheckForUpdates](docs/sdks/updater/README.md#checkforupdates) - Checking for updates * [ApplyUpdates](docs/sdks/updater/README.md#applyupdates) - Apply Updates - -### [Watchlist](docs/sdks/watchlist/README.md) - -* [GetWatchlist](docs/sdks/watchlist/README.md#getwatchlist) - Get User Watchlist + +## Retries + +Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. + +To change the default retry strategy for a single API call, simply provide a `retry.Config` object to the call by using the `WithRetries` option: +```go +package main + +import ( + "context" + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/retry" + "log" + "models/operations" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Server.GetServerCapabilities(ctx, operations.WithRetries( + retry.Config{ + Strategy: "backoff", + Backoff: &retry.BackoffStrategy{ + InitialInterval: 1, + MaxInterval: 50, + Exponent: 1.1, + MaxElapsedTime: 100, + }, + RetryConnectionErrors: false, + })) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} + +``` + +If you'd like to override the default retry strategy for all operations that support retries, you can use the `WithRetryConfig` option at SDK initialization: +```go +package main + +import ( + "context" + "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/retry" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithRetryConfig( + retry.Config{ + Strategy: "backoff", + Backoff: &retry.BackoffStrategy{ + InitialInterval: 1, + MaxInterval: 50, + Exponent: 1.1, + MaxElapsedTime: 100, + }, + RetryConnectionErrors: false, + }), + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Server.GetServerCapabilities(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} + +``` + + ## Error Handling Handling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both. When specified by the OpenAPI spec document, the SDK will return the appropriate subclass. -| Error Object | Status Code | Content Type | -| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | -| sdkerrors.GetServerCapabilitiesResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +| Error Object | Status Code | Content Type | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| sdkerrors.GetServerCapabilitiesResponseBody | 400 | application/json | +| sdkerrors.GetServerCapabilitiesServerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | ### Example @@ -191,7 +309,7 @@ import ( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -204,6 +322,12 @@ func main() { log.Fatal(e.Error()) } + var e *sdkerrors.GetServerCapabilitiesServerResponseBody + if errors.As(err, &e) { + // handle error + log.Fatal(e.Error()) + } + var e *sdkerrors.SDKError if errors.As(err, &e) { // handle error @@ -224,7 +348,7 @@ You can override the default server globally using the `WithServerIndex` option | # | Server | Variables | | - | ------ | --------- | -| 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `http`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) | +| 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `https`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) | #### Example @@ -241,7 +365,7 @@ func main() { s := plexgo.New( plexgo.WithServerIndex(0), plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -279,7 +403,7 @@ func main() { s := plexgo.New( plexgo.WithServerURL("{protocol}://{ip}:{port}"), plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -309,19 +433,16 @@ import ( func main() { s := plexgo.New( - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var xPlexProduct string = "Postman" - var strong *bool = plexgo.Bool(false) - - var xPlexClientIdentifier *string = plexgo.String("Postman") ctx := context.Background() - res, err := s.Plex.GetPin(ctx, xPlexProduct, strong, xPlexClientIdentifier, operations.WithServerURL("https://plex.tv/api/v2")) + res, err := s.Plex.GetCompanionsData(ctx, operations.WithServerURL("https://plex.tv/api/v2/")) if err != nil { log.Fatal(err) } - if res.Object != nil { + if res.ResponseBodies != nil { // handle response } } @@ -382,7 +503,7 @@ import ( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -429,7 +550,7 @@ d6 := types.MustDateFromString("2019-01-01") // returns types.Date and panics on A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed. -For example, you can set `X-Plex-Client-Identifier` to `"Postman"` at SDK initialization and then you do not have to pass the same value on calls to operations like `GetPin`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration. +For example, you can set `X-Plex-Client-Identifier` to `"gcgzw5rz2xovp84b4vha3a40"` at SDK initialization and then you do not have to pass the same value on calls to operations like `GetServerResources`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration. ### Available Globals @@ -452,24 +573,27 @@ package main import ( "context" "github.com/LukeHagar/plexgo" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var xPlexProduct string = "Postman" - var strong *bool = plexgo.Bool(false) - - var xPlexClientIdentifier *string = plexgo.String("Postman") ctx := context.Background() - res, err := s.Plex.GetPin(ctx, xPlexProduct, strong, xPlexClientIdentifier) + res, err := s.Plex.GetServerResources(ctx, operations.GetServerResourcesRequest{ + XPlexToken: "CV5xoxjTpFKUzBTShsaf", + IncludeHTTPS: operations.IncludeHTTPSOne.ToPointer(), + IncludeRelay: operations.IncludeRelayOne.ToPointer(), + IncludeIPv6: operations.IncludeIPv6One.ToPointer(), + }) if err != nil { log.Fatal(err) } - if res.Object != nil { + if res.PlexDevices != nil { // handle response } } diff --git a/USAGE.md b/USAGE.md index 2034eee..49a74a8 100644 --- a/USAGE.md +++ b/USAGE.md @@ -11,7 +11,7 @@ import ( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() diff --git a/activities.go b/activities.go index ca3e588..013f2d9 100644 --- a/activities.go +++ b/activities.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -34,7 +35,7 @@ func newActivities(sdkConfig sdkConfiguration) *Activities { // GetServerActivities - Get Server Activities // Get Server Activities -func (s *Activities) GetServerActivities(ctx context.Context) (*operations.GetServerActivitiesResponse, error) { +func (s *Activities) GetServerActivities(ctx context.Context, opts ...operations.Option) (*operations.GetServerActivitiesResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getServerActivities", @@ -42,12 +43,35 @@ func (s *Activities) GetServerActivities(ctx context.Context) (*operations.GetSe SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/activities") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -59,33 +83,89 @@ func (s *Activities) GetServerActivities(ctx context.Context) (*operations.GetSe return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetServerActivitiesResponse{ @@ -94,17 +174,25 @@ func (s *Activities) GetServerActivities(ctx context.Context) (*operations.GetSe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetServerActivitiesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -112,17 +200,21 @@ func (s *Activities) GetServerActivities(ctx context.Context) (*operations.GetSe res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetServerActivitiesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -131,9 +223,51 @@ func (s *Activities) GetServerActivities(ctx context.Context) (*operations.GetSe out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetServerActivitiesActivitiesResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -143,7 +277,7 @@ func (s *Activities) GetServerActivities(ctx context.Context) (*operations.GetSe // CancelServerActivities - Cancel Server Activities // Cancel Server Activities -func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID string) (*operations.CancelServerActivitiesResponse, error) { +func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID string, opts ...operations.Option) (*operations.CancelServerActivitiesResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "cancelServerActivities", @@ -155,12 +289,35 @@ func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID st ActivityUUID: activityUUID, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/activities/{activityUUID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -172,33 +329,89 @@ func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID st return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.CancelServerActivitiesResponse{ @@ -207,24 +420,26 @@ func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID st RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.CancelServerActivitiesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -233,9 +448,51 @@ func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID st out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.CancelServerActivitiesActivitiesResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/authentication.go b/authentication.go index 18fe883..9bbbfb0 100644 --- a/authentication.go +++ b/authentication.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -28,7 +29,7 @@ func newAuthentication(sdkConfig sdkConfiguration) *Authentication { // GetTransientToken - Get a Transient Token. // This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted. -func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations.GetTransientTokenQueryParamType, scope operations.Scope) (*operations.GetTransientTokenResponse, error) { +func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations.GetTransientTokenQueryParamType, scope operations.Scope, opts ...operations.Option) (*operations.GetTransientTokenResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getTransientToken", @@ -41,12 +42,35 @@ func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations Scope: scope, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/security/token") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -62,33 +86,89 @@ func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetTransientTokenResponse{ @@ -97,24 +177,26 @@ func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetTransientTokenResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -123,9 +205,51 @@ func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetTransientTokenAuthenticationResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -136,7 +260,7 @@ func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations // GetSourceConnectionInformation - Get Source Connection Information // If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token. // Note: requires Plex Media Server >= 1.15.4. -func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, source string) (*operations.GetSourceConnectionInformationResponse, error) { +func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, source string, opts ...operations.Option) (*operations.GetSourceConnectionInformationResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getSourceConnectionInformation", @@ -148,12 +272,35 @@ func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, sou Source: source, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/security/resources") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -169,33 +316,89 @@ func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, sou return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetSourceConnectionInformationResponse{ @@ -204,24 +407,26 @@ func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, sou RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetSourceConnectionInformationResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -230,9 +435,568 @@ func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, sou out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetSourceConnectionInformationAuthenticationResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetUserDetails - Get User Data By Token +// Get the User data from the provided X-Plex-Token +func (s *Authentication) GetUserDetails(ctx context.Context, xPlexToken string, opts ...operations.Option) (*operations.GetUserDetailsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getUserDetails", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetUserDetailsRequest{ + XPlexToken: xPlexToken, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionServerURL, + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(operations.GetUserDetailsServerList[0], map[string]string{}) + if o.ServerURL != nil { + baseURL = *o.ServerURL + } + + opURL, err := url.JoinPath(baseURL, "/user") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetUserDetailsResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetUserDetailsUserPlexAccount + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.UserPlexAccount = &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetUserDetailsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetUserDetailsAuthenticationResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// PostUsersSignInData - Get User Sign In Data +// Sign in user with username and password and return user data with Plex authentication token +func (s *Authentication) PostUsersSignInData(ctx context.Context, xPlexClientIdentifier *string, requestBody *operations.PostUsersSignInDataRequestBody, opts ...operations.Option) (*operations.PostUsersSignInDataResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "post-users-sign-in-data", + OAuth2Scopes: []string{}, + SecuritySource: nil, + } + + request := operations.PostUsersSignInDataRequest{ + XPlexClientIdentifier: xPlexClientIdentifier, + RequestBody: requestBody, + } + + globals := operations.PostUsersSignInDataGlobals{ + XPlexClientIdentifier: s.sdkConfiguration.Globals.XPlexClientIdentifier, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionServerURL, + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(operations.PostUsersSignInDataServerList[0], map[string]string{}) + if o.ServerURL != nil { + baseURL = *o.ServerURL + } + + opURL, err := url.JoinPath(baseURL, "/users/signin") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "RequestBody", "form", `request:"mediaType=application/x-www-form-urlencoded"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + req.Header.Set("Content-Type", reqContentType) + + if err := utils.PopulateQueryParams(ctx, req, request, globals); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.PostUsersSignInDataResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 201: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.PostUsersSignInDataUserPlexAccount + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.UserPlexAccount = &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.PostUsersSignInDataResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.PostUsersSignInDataAuthenticationResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/butler.go b/butler.go index f6c688e..3ec29a9 100644 --- a/butler.go +++ b/butler.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -28,7 +29,7 @@ func newButler(sdkConfig sdkConfiguration) *Butler { // GetButlerTasks - Get Butler tasks // Returns a list of butler tasks -func (s *Butler) GetButlerTasks(ctx context.Context) (*operations.GetButlerTasksResponse, error) { +func (s *Butler) GetButlerTasks(ctx context.Context, opts ...operations.Option) (*operations.GetButlerTasksResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getButlerTasks", @@ -36,12 +37,35 @@ func (s *Butler) GetButlerTasks(ctx context.Context) (*operations.GetButlerTasks SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/butler") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -53,33 +77,89 @@ func (s *Butler) GetButlerTasks(ctx context.Context) (*operations.GetButlerTasks return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetButlerTasksResponse{ @@ -88,17 +168,25 @@ func (s *Butler) GetButlerTasks(ctx context.Context) (*operations.GetButlerTasks RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetButlerTasksResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -106,17 +194,21 @@ func (s *Butler) GetButlerTasks(ctx context.Context) (*operations.GetButlerTasks res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetButlerTasksResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -125,9 +217,51 @@ func (s *Butler) GetButlerTasks(ctx context.Context) (*operations.GetButlerTasks out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetButlerTasksButlerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -141,7 +275,7 @@ func (s *Butler) GetButlerTasks(ctx context.Context) (*operations.GetButlerTasks // 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately. // 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window. // 4. If we are outside the configured window, the task will start immediately. -func (s *Butler) StartAllTasks(ctx context.Context) (*operations.StartAllTasksResponse, error) { +func (s *Butler) StartAllTasks(ctx context.Context, opts ...operations.Option) (*operations.StartAllTasksResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "startAllTasks", @@ -149,12 +283,35 @@ func (s *Butler) StartAllTasks(ctx context.Context) (*operations.StartAllTasksRe SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/butler") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -166,33 +323,89 @@ func (s *Butler) StartAllTasks(ctx context.Context) (*operations.StartAllTasksRe return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.StartAllTasksResponse{ @@ -201,24 +414,26 @@ func (s *Butler) StartAllTasks(ctx context.Context) (*operations.StartAllTasksRe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.StartAllTasksResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -227,9 +442,51 @@ func (s *Butler) StartAllTasks(ctx context.Context) (*operations.StartAllTasksRe out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.StartAllTasksButlerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -239,7 +496,7 @@ func (s *Butler) StartAllTasks(ctx context.Context) (*operations.StartAllTasksRe // StopAllTasks - Stop all Butler tasks // This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue. -func (s *Butler) StopAllTasks(ctx context.Context) (*operations.StopAllTasksResponse, error) { +func (s *Butler) StopAllTasks(ctx context.Context, opts ...operations.Option) (*operations.StopAllTasksResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "stopAllTasks", @@ -247,12 +504,35 @@ func (s *Butler) StopAllTasks(ctx context.Context) (*operations.StopAllTasksResp SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/butler") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -264,33 +544,89 @@ func (s *Butler) StopAllTasks(ctx context.Context) (*operations.StopAllTasksResp return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.StopAllTasksResponse{ @@ -299,24 +635,26 @@ func (s *Butler) StopAllTasks(ctx context.Context) (*operations.StopAllTasksResp RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.StopAllTasksResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -325,9 +663,51 @@ func (s *Butler) StopAllTasks(ctx context.Context) (*operations.StopAllTasksResp out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.StopAllTasksButlerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -341,7 +721,7 @@ func (s *Butler) StopAllTasks(ctx context.Context) (*operations.StopAllTasksResp // 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately. // 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window. // 4. If we are outside the configured window, the task will start immediately. -func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName) (*operations.StartTaskResponse, error) { +func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName, opts ...operations.Option) (*operations.StartTaskResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "startTask", @@ -353,12 +733,35 @@ func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName) (* TaskName: taskName, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/butler/{taskName}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -370,33 +773,89 @@ func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName) (* return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.StartTaskResponse{ @@ -405,26 +864,28 @@ func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName) (* RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: fallthrough case httpRes.StatusCode == 202: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.StartTaskResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -433,9 +894,51 @@ func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName) (* out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.StartTaskButlerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -445,7 +948,7 @@ func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName) (* // StopTask - Stop a single Butler task // This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint. -func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTaskName) (*operations.StopTaskResponse, error) { +func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTaskName, opts ...operations.Option) (*operations.StopTaskResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "stopTask", @@ -457,12 +960,35 @@ func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTask TaskName: taskName, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/butler/{taskName}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -474,33 +1000,89 @@ func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTask return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "404", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.StopTaskResponse{ @@ -509,26 +1091,26 @@ func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTask RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode == 404: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.StopTaskResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -537,9 +1119,53 @@ func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTask out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.StopTaskButlerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/codeSamples.yaml b/codeSamples.yaml index 3d71c1b..b52d954 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,1104 +3,6 @@ info: title: CodeSamples overlay for go target version: 0.0.0 actions: - - target: $["paths"]["/playlists"]["get"] - update: - x-codeSamples: - - lang: go - label: getPlaylists - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var playlistType *operations.PlaylistType = operations.PlaylistTypeAudio.ToPointer() - - var smart *operations.QueryParamSmart = operations.QueryParamSmartZero.ToPointer() - ctx := context.Background() - res, err := s.Playlists.GetPlaylists(ctx, playlistType, smart) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/status/sessions/history/all"]["get"] - update: - x-codeSamples: - - lang: go - label: getSessionHistory - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var sort *string = plexgo.String("") - - var accountID *int64 = plexgo.Int64(1) - - var filter *operations.Filter = &operations.Filter{} - - var librarySectionID *int64 = plexgo.Int64(12) - ctx := context.Background() - res, err := s.Sessions.GetSessionHistory(ctx, sort, accountID, filter, librarySectionID) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var sessionKey string = "zz7llzqlx8w9vnrsbnwhbmep" - ctx := context.Background() - res, err := s.Sessions.StopTranscodeSession(ctx, sessionKey) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/:/timeline"]["get"] - update: - x-codeSamples: - - lang: go - label: getTimeline - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - request := 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, - } - ctx := context.Background() - res, err := s.Video.GetTimeline(ctx, request) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Butler.StopAllTasks(ctx) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/library/recentlyAdded"]["get"] - update: - x-codeSamples: - - lang: go - label: getRecentlyAdded - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Library.GetRecentlyAdded(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var request string = "level=4&message=Test%20message%201&source=postman - level=3&message=Test%20message%202&source=postman - level=1&message=Test%20message%203&source=postman" - ctx := context.Background() - res, err := s.Log.LogMultiLine(ctx, request) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var source string = "server://client-identifier" - ctx := context.Background() - res, err := s.Authentication.GetSourceConnectionInformation(ctx, source) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/photo/:/transcode"]["get"] - update: - x-codeSamples: - - lang: go - label: getResizedPhoto - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - request := operations.GetResizedPhotoRequest{ - Width: 110, - Height: 165, - Opacity: 100, - Blur: 20, - MinSize: operations.MinSizeOne, - Upscale: operations.UpscaleZero, - URL: "/library/metadata/49564/thumb/1654258204", - } - ctx := context.Background() - res, err := s.Server.GetResizedPhoto(ctx, request) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/library/sections/{sectionId}"]["get"] - update: - x-codeSamples: - - lang: go - label: getLibrary - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var sectionID float64 = 1000 - - var includeDetails *operations.IncludeDetails = operations.IncludeDetailsZero.ToPointer() - ctx := context.Background() - res, err := s.Library.GetLibrary(ctx, sectionID, includeDetails) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Library.GetOnDeck(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var playlistID float64 = 4109.48 - ctx := context.Background() - res, err := s.Playlists.GetPlaylist(ctx, playlistID) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Log.EnablePaperTrail(ctx) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var playlistID float64 = 216.22 - ctx := context.Background() - res, err := s.Playlists.DeletePlaylist(ctx, playlistID) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/log"]["get"] - update: - x-codeSamples: - - lang: go - label: logLine - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var level operations.Level = operations.LevelThree - - var message string = "Test log message" - - var source string = "Postman" - ctx := context.Background() - res, err := s.Log.LogLine(ctx, level, message, source) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var key float64 = 59398 - ctx := context.Background() - res, err := s.Media.MarkPlayed(ctx, key) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var query string = "dylan" - - var sectionID *float64 = plexgo.Float64(1516.53) - - var limit *float64 = plexgo.Float64(5) - ctx := context.Background() - res, err := s.Search.PerformSearch(ctx, query, sectionID, limit) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/library/sections/{sectionId}"]["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.WithXPlexClientIdentifier("Postman"), - ) - var sectionID float64 = 1000 - ctx := context.Background() - res, err := s.Library.DeleteLibrary(ctx, sectionID) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/library/all/top"]["get"] - update: - x-codeSamples: - - lang: go - label: getTopWatchedContent - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var type_ int64 = 505531 - - var includeGuids *int64 = plexgo.Int64(1) - ctx := context.Background() - res, err := s.Library.GetTopWatchedContent(ctx, type_, includeGuids) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/butler/{taskName}"]["post"] - update: - x-codeSamples: - - lang: go - label: startTask - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var taskName operations.TaskName = operations.TaskNameCleanOldBundles - ctx := context.Background() - res, err := s.Butler.StartTask(ctx, taskName) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var playlistID float64 = 8502.01 - - var uri string = "server://12345/com.plexapp.plugins.library/library/metadata/1" - - var playQueueID *float64 = plexgo.Float64(123) - ctx := context.Background() - res, err := s.Playlists.AddPlaylistContents(ctx, playlistID, uri, playQueueID) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/video/:/transcode/universal/start.mpd"]["get"] - update: - x-codeSamples: - - lang: go - label: startUniversalTranscode - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - request := 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), - } - ctx := context.Background() - res, err := s.Video.StartUniversalTranscode(ctx, request) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/hubs/sections/{sectionId}"]["get"] - update: - x-codeSamples: - - lang: go - label: getLibraryHubs - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var sectionID float64 = 6728.76 - - var count *float64 = plexgo.Float64(9010.22) - - var onlyTransient *operations.QueryParamOnlyTransient = operations.QueryParamOnlyTransientZero.ToPointer() - ctx := context.Background() - res, err := s.Hubs.GetLibraryHubs(ctx, sectionID, count, onlyTransient) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/playlists/{playlistID}/items"]["get"] - update: - x-codeSamples: - - lang: go - label: getPlaylistContents - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var playlistID float64 = 5004.46 - - var type_ float64 = 9403.59 - ctx := context.Background() - res, err := s.Playlists.GetPlaylistContents(ctx, playlistID, type_) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var playlistID float64 = 1893.18 - ctx := context.Background() - res, err := s.Playlists.ClearPlaylistContents(ctx, playlistID) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/library/sections/watchlist/{filter}"]["get"] - update: - x-codeSamples: - - lang: go - label: getWatchlist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - request := operations.GetWatchlistRequest{ - Filter: operations.PathParamFilterReleased, - XPlexToken: "", - } - ctx := context.Background() - res, err := s.Watchlist.GetWatchlist(ctx, request) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/identity"]["get"] - update: - x-codeSamples: - - lang: go - label: getServerIdentity - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Server.GetServerIdentity(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Butler.GetButlerTasks(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Butler.StartAllTasks(ctx) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/library/metadata/{ratingKey}"]["get"] - update: - x-codeSamples: - - lang: go - label: getMetadata - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var ratingKey float64 = 8382.31 - ctx := context.Background() - res, err := s.Library.GetMetadata(ctx, ratingKey) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Server.GetAvailableClients(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var url_ string = "file://C:\Image.png&type=13" - - var type_ *float64 = plexgo.Float64(4462.17) - ctx := context.Background() - res, err := s.Library.GetFileHash(ctx, url_, type_) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var timespan *int64 = plexgo.Int64(4) - ctx := context.Background() - res, err := s.Statistics.GetResourcesStatistics(ctx, timespan) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var timespan *int64 = plexgo.Int64(4) - ctx := context.Background() - res, err := s.Statistics.GetBandwidthStatistics(ctx, timespan) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Sessions.GetSessions(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - target: $["paths"]["/"]["get"] update: x-codeSamples: @@ -1118,7 +20,7 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -1147,7 +49,7 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -1176,15 +78,11 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var key string = "" - var time float64 = 90000 - - var state string = "played" ctx := context.Background() - res, err := s.Media.UpdatePlayProgress(ctx, key, time, state) + res, err := s.Media.UpdatePlayProgress(ctx, "", 90000, "played") if err != nil { log.Fatal(err) } @@ -1192,11 +90,11 @@ actions: // handle response } } - - target: $["paths"]["/pins/{pinID}"]["get"] + - target: $["paths"]["/:/scrobble"]["get"] update: x-codeSamples: - lang: go - label: getToken + label: markPlayed source: |- package main @@ -1206,45 +104,14 @@ actions: "log" ) - func main() { - s := plexgo.New( - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var pinID string = "" - - var xPlexClientIdentifier *string = plexgo.String("Postman") - ctx := context.Background() - res, err := s.Plex.GetToken(ctx, pinID, xPlexClientIdentifier) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/butler/{taskName}"]["delete"] - update: - x-codeSamples: - - lang: go - label: stopTask - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var taskName operations.PathParamTaskName = operations.PathParamTaskNameBackupDatabase + ctx := context.Background() - res, err := s.Butler.StopTask(ctx, taskName) + res, err := s.Media.MarkPlayed(ctx, 59398) if err != nil { log.Fatal(err) } @@ -1252,124 +119,40 @@ actions: // handle response } } - - target: $["paths"]["/pins"]["post"] + - target: $["paths"]["/:/timeline"]["get"] update: x-codeSamples: - lang: go - label: getPin + label: getTimeline source: |- package main import( "github.com/LukeHagar/plexgo" "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var xPlexProduct string = "Postman" - - var strong *bool = plexgo.Bool(false) - - var xPlexClientIdentifier *string = plexgo.String("Postman") - ctx := context.Background() - res, err := s.Plex.GetPin(ctx, xPlexProduct, strong, xPlexClientIdentifier) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/library/sections/{sectionId}/search"]["get"] - update: - x-codeSamples: - - lang: go - label: searchLibrary - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" "github.com/LukeHagar/plexgo/models/operations" - "context" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sectionID int64 = 933505 - var type_ operations.Type = operations.TypeFour ctx := context.Background() - res, err := s.Library.SearchLibrary(ctx, sectionID, type_) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var query string = "110" - ctx := context.Background() - res, err := s.Search.GetSearchResults(ctx, query) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/updater/apply"]["put"] - update: - x-codeSamples: - - lang: go - label: applyUpdates - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var tonight *operations.Tonight = operations.TonightOne.ToPointer() - - var skip *operations.Skip = operations.SkipOne.ToPointer() - ctx := context.Background() - res, err := s.Updater.ApplyUpdates(ctx, tonight, skip) + 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) } @@ -1394,11 +177,11 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var key float64 = 59398 + ctx := context.Background() - res, err := s.Media.MarkUnplayed(ctx, key) + res, err := s.Media.MarkUnplayed(ctx, 59398) if err != nil { log.Fatal(err) } @@ -1423,7 +206,7 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -1435,160 +218,6 @@ actions: // handle response } } - - 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.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Plex.GetHomeData(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - target: $["paths"]["/playlists/upload"]["post"] - update: - x-codeSamples: - - lang: go - label: uploadPlaylist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - var path string = "/home/barkley/playlist.m3u" - - var force operations.Force = operations.ForceZero - ctx := context.Background() - res, err := s.Playlists.UploadPlaylist(ctx, path, force) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/playlists"]["post"] - update: - x-codeSamples: - - lang: go - label: createPlaylist - source: |- - package main - - import( - "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" - "context" - "log" - ) - - func main() { - s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), - ) - request := operations.CreatePlaylistRequest{ - Title: "", - Type: operations.QueryParamTypePhoto, - Smart: operations.SmartOne, - URI: "https://inborn-brochure.biz", - } - ctx := context.Background() - res, err := s.Playlists.CreatePlaylist(ctx, request) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - var timespan *int64 = plexgo.Int64(4) - ctx := context.Background() - res, err := s.Statistics.GetStatistics(ctx, timespan) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - - 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.WithXPlexClientIdentifier("Postman"), - ) - - ctx := context.Background() - res, err := s.Sessions.GetTranscodeSessions(ctx) - if err != nil { - log.Fatal(err) - } - if res.Object != nil { - // handle response - } - } - target: $["paths"]["/activities/{activityUUID}"]["delete"] update: x-codeSamples: @@ -1606,11 +235,11 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var activityUUID string = "25b71ed5-0f9d-461c-baa7-d404e9e10d3e" + ctx := context.Background() - res, err := s.Activities.CancelServerActivities(ctx, activityUUID) + res, err := s.Activities.CancelServerActivities(ctx, "25b71ed5-0f9d-461c-baa7-d404e9e10d3e") if err != nil { log.Fatal(err) } @@ -1618,17 +247,16 @@ actions: // handle response } } - - target: $["paths"]["/hubs"]["get"] + - target: $["paths"]["/butler"]["delete"] update: x-codeSamples: - lang: go - label: getGlobalHubs + label: stopAllTasks source: |- package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" "log" ) @@ -1636,13 +264,40 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var count *float64 = plexgo.Float64(1262.49) - var onlyTransient *operations.OnlyTransient = operations.OnlyTransientOne.ToPointer() ctx := context.Background() - res, err := s.Hubs.GetGlobalHubs(ctx, count, onlyTransient) + res, err := s.Butler.StopAllTasks(ctx) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Butler.GetButlerTasks(ctx) if err != nil { log.Fatal(err) } @@ -1650,11 +305,11 @@ actions: // handle response } } - - target: $["paths"]["/hubs/search/voice"]["get"] + - target: $["paths"]["/butler"]["post"] update: x-codeSamples: - lang: go - label: performVoiceSearch + label: startAllTasks source: |- package main @@ -1667,15 +322,11 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var query string = "dead+poop" - var sectionID *float64 = plexgo.Float64(4094.8) - - var limit *float64 = plexgo.Float64(5) ctx := context.Background() - res, err := s.Search.PerformVoiceSearch(ctx, query, sectionID, limit) + res, err := s.Butler.StartAllTasks(ctx) if err != nil { log.Fatal(err) } @@ -1683,17 +334,76 @@ actions: // handle response } } - - target: $["paths"]["/library/sections/{sectionId}/{tag}"]["get"] + - target: $["paths"]["/butler/{taskName}"]["delete"] update: x-codeSamples: - lang: go - label: getLibraryItems + 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Butler.StopTask(ctx, operations.PathParamTaskNameBackupDatabase) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Butler.StartTask(ctx, operations.TaskNameCleanOldBundles) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/clients"]["get"] + update: + x-codeSamples: + - lang: go + label: getAvailableClients + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" "context" "log" ) @@ -1701,15 +411,11 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sectionID any = "" - var tag operations.Tag = operations.TagGenre - - var includeGuids *int64 = plexgo.Int64(1) ctx := context.Background() - res, err := s.Library.GetLibraryItems(ctx, sectionID, tag, includeGuids) + res, err := s.Server.GetAvailableClients(ctx) if err != nil { log.Fatal(err) } @@ -1717,17 +423,16 @@ actions: // handle response } } - - target: $["paths"]["/security/token"]["get"] + - target: $["paths"]["/companions"]["get"] update: x-codeSamples: - lang: go - label: getTransientToken + label: getCompanionsData source: |- package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" "log" ) @@ -1735,17 +440,15 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var type_ operations.GetTransientTokenQueryParamType = operations.GetTransientTokenQueryParamTypeDelegation - var scope operations.Scope = operations.ScopeAll ctx := context.Background() - res, err := s.Authentication.GetTransientToken(ctx, type_, scope) + res, err := s.Plex.GetCompanionsData(ctx) if err != nil { log.Fatal(err) } - if res != nil { + if res.ResponseBodies != nil { // handle response } } @@ -1766,7 +469,7 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -1778,6 +481,824 @@ actions: // handle response } } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Plex.GetUserFriends(ctx) + if err != nil { + log.Fatal(err) + } + if res.Friends != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Plex.GetGeoData(ctx) + if err != nil { + log.Fatal(err) + } + if res.GeoData != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Plex.GetHomeData(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Hubs.GetGlobalHubs(ctx, nil, nil) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Server.GetServerIdentity(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.GetTopWatchedContent(ctx, operations.GetTopWatchedContentQueryParamTypeTwo, plexgo.Int64(1)) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.GetMetaDataByRatingKey(ctx, 9518) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.GetMetadataChildren(ctx, 1539.14, plexgo.String("Stream")) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.GetOnDeck(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - target: $["paths"]["/library/recentlyAdded"]["get"] + update: + x-codeSamples: + - lang: go + label: getRecentlyAdded + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.GetRecentlyAdded(ctx, plexgo.Int(0), plexgo.Int(50)) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.GetAllLibraries(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.DeleteLibrary(ctx, 9518) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.GetLibraryDetails(ctx, 9518, nil) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.GetRefreshLibraryMetadata(ctx, 9518, operations.ForceOne.ToPointer()) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.GetSearchLibrary(ctx, 9518, operations.QueryParamTypeTwo) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{ + SectionKey: 9518, + Tag: operations.TagEdition, + IncludeGuids: operations.IncludeGuidsOne.ToPointer(), + IncludeMeta: operations.IncludeMetaOne.ToPointer(), + Type: operations.TypeTwo, + XPlexContainerStart: plexgo.Int(0), + XPlexContainerSize: plexgo.Int(50), + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Log.EnablePaperTrail(ctx) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Server.GetMediaProviders(ctx, "CV5xoxjTpFKUzBTShsaf") + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } - target: $["paths"]["/myplex/account"]["get"] update: x-codeSamples: @@ -1795,7 +1316,7 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -1807,28 +1328,37 @@ actions: // handle response } } - - target: $["paths"]["/library/sections/{sectionId}/refresh"]["get"] + - target: $["paths"]["/photo/:/transcode"]["get"] update: x-codeSamples: - lang: go - label: refreshLibrary + 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.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sectionID float64 = 934.16 + ctx := context.Background() - res, err := s.Library.RefreshLibrary(ctx, sectionID) + res, err := s.Server.GetResizedPhoto(ctx, operations.GetResizedPhotoRequest{ + Width: 110, + Height: 165, + Opacity: 100, + Blur: 20, + MinSize: operations.MinSizeOne, + Upscale: operations.UpscaleOne, + URL: "/library/metadata/49564/thumb/1654258204", + }) if err != nil { log.Fatal(err) } @@ -1836,11 +1366,67 @@ actions: // handle response } } - - target: $["paths"]["/library/metadata/{ratingKey}/children"]["get"] + - target: $["paths"]["/pins"]["post"] update: x-codeSamples: - lang: go - label: getMetadataChildren + label: getPin + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Plex.GetPin(ctx, nil, plexgo.String("gcgzw5rz2xovp84b4vha3a40"), plexgo.String("Plex Web")) + if err != nil { + log.Fatal(err) + } + if res.AuthPinContainer != nil { + // handle response + } + } + - target: $["paths"]["/pins/{pinID}"]["get"] + update: + x-codeSamples: + - lang: go + label: getTokenByPinId + source: |- + package main + + import( + "github.com/LukeHagar/plexgo" + "context" + "log" + ) + + func main() { + s := plexgo.New( + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Plex.GetTokenByPinID(ctx, 408895, plexgo.String("gcgzw5rz2xovp84b4vha3a40")) + if err != nil { + log.Fatal(err) + } + if res.AuthPinContainer != nil { + // handle response + } + } + - target: $["paths"]["/playlists"]["get"] + update: + x-codeSamples: + - lang: go + label: getPlaylists source: |- package main @@ -1853,13 +1439,11 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var ratingKey float64 = 1539.14 - var includeElements *string = plexgo.String("") ctx := context.Background() - res, err := s.Library.GetMetadataChildren(ctx, ratingKey, includeElements) + res, err := s.Playlists.GetPlaylists(ctx, nil, nil) if err != nil { log.Fatal(err) } @@ -1867,11 +1451,76 @@ actions: // handle response } } - - target: $["paths"]["/library/sections"]["get"] + - target: $["paths"]["/playlists"]["post"] update: x-codeSamples: - lang: go - label: getLibraries + 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Playlists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{ + Title: "", + Type: operations.CreatePlaylistQueryParamTypePhoto, + Smart: operations.SmartOne, + URI: "https://inborn-brochure.biz", + }) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Playlists.UploadPlaylist(ctx, "/home/barkley/playlist.m3u", operations.QueryParamForceZero) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - target: $["paths"]["/playlists/{playlistID}"]["delete"] + update: + x-codeSamples: + - lang: go + label: deletePlaylist source: |- package main @@ -1884,11 +1533,40 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() - res, err := s.Library.GetLibraries(ctx) + res, err := s.Playlists.DeletePlaylist(ctx, 216.22) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Playlists.GetPlaylist(ctx, 4109.48) if err != nil { log.Fatal(err) } @@ -1913,15 +1591,222 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var playlistID float64 = 3915 - var title *string = plexgo.String("") - - var summary *string = plexgo.String("") ctx := context.Background() - res, err := s.Playlists.UpdatePlaylist(ctx, playlistID, title, summary) + res, err := s.Playlists.UpdatePlaylist(ctx, 3915, nil, nil) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Playlists.ClearPlaylistContents(ctx, 1893.18) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Playlists.GetPlaylistContents(ctx, 5004.46, operations.GetPlaylistContentsQueryParamTypeTwo) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Plex.GetServerResources(ctx, operations.GetServerResourcesRequest{ + XPlexToken: "CV5xoxjTpFKUzBTShsaf", + IncludeHTTPS: operations.IncludeHTTPSOne.ToPointer(), + IncludeRelay: operations.IncludeRelayOne.ToPointer(), + IncludeIPv6: operations.IncludeIPv6One.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.PlexDevices != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Search.GetSearchResults(ctx, "110") + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Authentication.GetSourceConnectionInformation(ctx, "server://client-identifier") + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Authentication.GetTransientToken(ctx, operations.GetTransientTokenQueryParamTypeDelegation, operations.ScopeAll) if err != nil { log.Fatal(err) } @@ -1946,7 +1831,7 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -1958,6 +1843,270 @@ actions: // handle response } } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Statistics.GetBandwidthStatistics(ctx, plexgo.Int64(4)) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Statistics.GetStatistics(ctx, plexgo.Int64(4)) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Statistics.GetResourcesStatistics(ctx, plexgo.Int64(4)) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Sessions.GetSessions(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Sessions.GetTranscodeSessions(ctx) + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Sessions.StopTranscodeSession(ctx, "zz7llzqlx8w9vnrsbnwhbmep") + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Updater.CheckForUpdates(ctx, operations.DownloadOne.ToPointer()) + if err != nil { + log.Fatal(err) + } + if res != nil { + // handle response + } + } - target: $["paths"]["/updater/status"]["get"] update: x-codeSamples: @@ -1975,7 +2124,7 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -1987,17 +2136,16 @@ actions: // handle response } } - - target: $["paths"]["/updater/check"]["put"] + - target: $["paths"]["/user"]["get"] update: x-codeSamples: - lang: go - label: checkForUpdates + label: getUserDetails source: |- package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" "log" ) @@ -2005,11 +2153,91 @@ actions: func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var download *operations.Download = operations.DownloadOne.ToPointer() + ctx := context.Background() - res, err := s.Updater.CheckForUpdates(ctx, download) + res, err := s.Authentication.GetUserDetails(ctx, "CV5xoxjTpFKUzBTShsaf") + if err != nil { + log.Fatal(err) + } + if res.UserPlexAccount != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Authentication.PostUsersSignInData(ctx, plexgo.String("gcgzw5rz2xovp84b4vha3a40"), &operations.PostUsersSignInDataRequestBody{ + Login: "username@email.com", + Password: "password123", + VerificationCode: plexgo.String("123456"), + }) + if err != nil { + log.Fatal(err) + } + if res.UserPlexAccount != nil { + // handle response + } + } + - 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.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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) } diff --git a/docs/models/components/security.md b/docs/models/components/security.md index cd7c168..1ac74be 100644 --- a/docs/models/components/security.md +++ b/docs/models/components/security.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | | ------------------ | ------------------ | ------------------ | ------------------ | -| `AccessToken` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file +| `AccessToken` | **string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/applyupdatesrequest.md b/docs/models/operations/applyupdatesrequest.md index c4ad949..cd95c0e 100644 --- a/docs/models/operations/applyupdatesrequest.md +++ b/docs/models/operations/applyupdatesrequest.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Tonight` | [*operations.Tonight](../../models/operations/tonight.md) | :heavy_minus_sign: | Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install | 1 | -| `Skip` | [*operations.Skip](../../models/operations/skip.md) | :heavy_minus_sign: | Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. | 1 | \ No newline at end of file +| `Skip` | [*operations.Skip](../../models/operations/skip.md) | :heavy_minus_sign: | Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`. | 1 | \ No newline at end of file diff --git a/docs/models/operations/autoselectsubtitle.md b/docs/models/operations/autoselectsubtitle.md new file mode 100644 index 0000000..dab0b29 --- /dev/null +++ b/docs/models/operations/autoselectsubtitle.md @@ -0,0 +1,11 @@ +# AutoSelectSubtitle + +The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) + + +## Values + +| Name | Value | +| ------------------------ | ------------------------ | +| `AutoSelectSubtitleZero` | 0 | +| `AutoSelectSubtitleOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/billing.md b/docs/models/operations/billing.md new file mode 100644 index 0000000..0375e9d --- /dev/null +++ b/docs/models/operations/billing.md @@ -0,0 +1,9 @@ +# Billing + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `InternalPaymentMethod` | [operations.InternalPaymentMethod](../../models/operations/internalpaymentmethod.md) | :heavy_check_mark: | N/A | +| `PaymentMethodID` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/connections.md b/docs/models/operations/connections.md new file mode 100644 index 0000000..9346cc3 --- /dev/null +++ b/docs/models/operations/connections.md @@ -0,0 +1,14 @@ +# Connections + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Protocol` | *string* | :heavy_check_mark: | N/A | +| `Address` | *string* | :heavy_check_mark: | N/A | +| `Port` | *float64* | :heavy_check_mark: | N/A | +| `URI` | *string* | :heavy_check_mark: | N/A | +| `Local` | *bool* | :heavy_check_mark: | N/A | +| `Relay` | *bool* | :heavy_check_mark: | N/A | +| `IPv6` | *bool* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/createplaylistqueryparamtype.md b/docs/models/operations/createplaylistqueryparamtype.md new file mode 100644 index 0000000..5f2699f --- /dev/null +++ b/docs/models/operations/createplaylistqueryparamtype.md @@ -0,0 +1,12 @@ +# CreatePlaylistQueryParamType + +type of playlist to create + + +## Values + +| Name | Value | +| ----------------------------------- | ----------------------------------- | +| `CreatePlaylistQueryParamTypeAudio` | audio | +| `CreatePlaylistQueryParamTypeVideo` | video | +| `CreatePlaylistQueryParamTypePhoto` | photo | \ No newline at end of file diff --git a/docs/models/operations/createplaylistrequest.md b/docs/models/operations/createplaylistrequest.md index 53f347a..8afc68d 100644 --- a/docs/models/operations/createplaylistrequest.md +++ b/docs/models/operations/createplaylistrequest.md @@ -3,10 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `Title` | *string* | :heavy_check_mark: | name of the playlist | -| `Type` | [operations.QueryParamType](../../models/operations/queryparamtype.md) | :heavy_check_mark: | type of playlist to create | -| `Smart` | [operations.Smart](../../models/operations/smart.md) | :heavy_check_mark: | whether the playlist is smart or not | -| `URI` | *string* | :heavy_check_mark: | the content URI for the playlist | -| `PlayQueueID` | **float64* | :heavy_minus_sign: | the play queue to copy to a playlist | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Title` | *string* | :heavy_check_mark: | name of the playlist | +| `Type` | [operations.CreatePlaylistQueryParamType](../../models/operations/createplaylistqueryparamtype.md) | :heavy_check_mark: | type of playlist to create | +| `Smart` | [operations.Smart](../../models/operations/smart.md) | :heavy_check_mark: | whether the playlist is smart or not | +| `URI` | *string* | :heavy_check_mark: | the content URI for the playlist | +| `PlayQueueID` | **float64* | :heavy_minus_sign: | the play queue to copy to a playlist | \ No newline at end of file diff --git a/docs/models/operations/defaultsubtitleaccessibility.md b/docs/models/operations/defaultsubtitleaccessibility.md new file mode 100644 index 0000000..c76ea9f --- /dev/null +++ b/docs/models/operations/defaultsubtitleaccessibility.md @@ -0,0 +1,11 @@ +# DefaultSubtitleAccessibility + +The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) + + +## Values + +| Name | Value | +| ---------------------------------- | ---------------------------------- | +| `DefaultSubtitleAccessibilityZero` | 0 | +| `DefaultSubtitleAccessibilityOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/defaultsubtitleforced.md b/docs/models/operations/defaultsubtitleforced.md new file mode 100644 index 0000000..61810cf --- /dev/null +++ b/docs/models/operations/defaultsubtitleforced.md @@ -0,0 +1,11 @@ +# DefaultSubtitleForced + +The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) + + +## Values + +| Name | Value | +| --------------------------- | --------------------------- | +| `DefaultSubtitleForcedZero` | 0 | +| `DefaultSubtitleForcedOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/deletelibraryrequest.md b/docs/models/operations/deletelibraryrequest.md index 0007af2..c58fde2 100644 --- a/docs/models/operations/deletelibraryrequest.md +++ b/docs/models/operations/deletelibraryrequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | ------------------------------ | -| `SectionID` | *float64* | :heavy_check_mark: | the Id of the library to query | 1000 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | \ No newline at end of file diff --git a/docs/models/operations/feature.md b/docs/models/operations/feature.md new file mode 100644 index 0000000..62641bf --- /dev/null +++ b/docs/models/operations/feature.md @@ -0,0 +1,10 @@ +# Feature + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Key` | **string* | :heavy_minus_sign: | N/A | +| `Type` | **string* | :heavy_minus_sign: | N/A | +| `Directory` | [][operations.GetMediaProvidersDirectory](../../models/operations/getmediaprovidersdirectory.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/features.md b/docs/models/operations/features.md new file mode 100644 index 0000000..12ee08a --- /dev/null +++ b/docs/models/operations/features.md @@ -0,0 +1,66 @@ +# Features + + +## Values + +| Name | Value | +| --------------------------------------------- | --------------------------------------------- | +| `FeaturesAndroidDolbyVision` | Android - Dolby Vision | +| `FeaturesAndroidPiP` | Android - PiP | +| `FeaturesCuSunset` | CU Sunset | +| `FeaturesHrkEnableEur` | HRK_enable_EUR | +| `FeaturesTrebleShowFeatures` | TREBLE-show-features | +| `FeaturesAdCountdownTimer` | ad-countdown-timer | +| `FeaturesAdaptiveBitrate` | adaptive_bitrate | +| `FeaturesAmazonLoopDebug` | amazon-loop-debug | +| `FeaturesAvodAdAnalysis` | avod-ad-analysis | +| `FeaturesAvodNewMedia` | avod-new-media | +| `FeaturesBlacklistGetSignin` | blacklist_get_signin | +| `FeaturesClientRadioStations` | client-radio-stations | +| `FeaturesCloudflareTurnstileRequired` | cloudflare-turnstile-required | +| `FeaturesCollections` | collections | +| `FeaturesCommentsAndRepliesPushNotifications` | comments_and_replies_push_notifications | +| `FeaturesCommunityAccessPlexTv` | community_access_plex_tv | +| `FeaturesCompanionsSonos` | companions_sonos | +| `FeaturesCustomHomeRemoval` | custom-home-removal | +| `FeaturesDisableHomeUserFriendships` | disable_home_user_friendships | +| `FeaturesDisableSharingFriendships` | disable_sharing_friendships | +| `FeaturesDrmSupport` | drm_support | +| `FeaturesExcludeRestrictions` | exclude restrictions | +| `FeaturesFederatedAuth` | federated-auth | +| `FeaturesFriendRequestPushNotifications` | friend_request_push_notifications | +| `FeaturesGuidedUpgrade` | guided-upgrade | +| `FeaturesHome` | home | +| `FeaturesIncreasePasswordComplexity` | increase-password-complexity | +| `FeaturesIos14PrivacyBanner` | ios14-privacy-banner | +| `FeaturesIterableNotificationTokens` | iterable-notification-tokens | +| `FeaturesKeepPaymentMethod` | keep-payment-method | +| `FeaturesKevinBacon` | kevin-bacon | +| `FeaturesKoreaConsent` | korea-consent | +| `FeaturesLeIsrgRootX1` | le_isrg_root_x1 | +| `FeaturesLetsEncrypt` | lets_encrypt | +| `FeaturesLightningDvrPivot` | lightning-dvr-pivot | +| `FeaturesLiveTvSupportIncompleteSegments` | live-tv-support-incomplete-segments | +| `FeaturesLivetv` | livetv | +| `FeaturesMetadataSearch` | metadata_search | +| `FeaturesNewPlexPassPrices` | new_plex_pass_prices | +| `FeaturesNewsProviderSunsetModal` | news-provider-sunset-modal | +| `FeaturesPhotosFavorites` | photos-favorites | +| `FeaturesPhotosMetadataEdition` | photos-metadata-edition | +| `FeaturesPmsHealth` | pms_health | +| `FeaturesRadio` | radio | +| `FeaturesRateLimitClientToken` | rate-limit-client-token | +| `FeaturesScrobblingServicePlexTv` | scrobbling-service-plex-tv | +| `FeaturesSharedServerNotification` | shared_server_notification | +| `FeaturesSharedSourceNotification` | shared_source_notification | +| `FeaturesSigninWithApple` | signin_with_apple | +| `FeaturesSpringServeAdProvider` | spring_serve_ad_provider | +| `FeaturesTranscoderCache` | transcoder_cache | +| `FeaturesTunerSharing` | tuner-sharing | +| `FeaturesTwoFactorAuthentication` | two-factor-authentication | +| `FeaturesUnsupportedtuners` | unsupportedtuners | +| `FeaturesUpgrade3ds2` | upgrade-3ds2 | +| `FeaturesVodSchema` | vod-schema | +| `FeaturesVodCloudflare` | vod_cloudflare | +| `FeaturesWatchTogetherInvite` | watch-together-invite | +| `FeaturesWebServerDashboard` | web_server_dashboard | \ No newline at end of file diff --git a/docs/models/operations/filter.md b/docs/models/operations/filter.md index 6b3af5a..43a9487 100644 --- a/docs/models/operations/filter.md +++ b/docs/models/operations/filter.md @@ -1,11 +1,12 @@ # Filter -Filters content by field and direction/equality -(Unknown if viewedAt is the only supported column) +Filter +## Values -## Fields - -| Field | Type | Required | Description | -| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file +| Name | Value | +| ----------------- | ----------------- | +| `FilterAll` | all | +| `FilterAvailable` | available | +| `FilterReleased` | released | \ No newline at end of file diff --git a/docs/models/operations/force.md b/docs/models/operations/force.md index e590cea..40cd1cc 100644 --- a/docs/models/operations/force.md +++ b/docs/models/operations/force.md @@ -1,10 +1,6 @@ # Force -Force overwriting of duplicate playlists. -By default, a playlist file uploaded with the same path will overwrite the existing playlist. -The `force` argument is used to disable overwriting. -If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded. - +Force the refresh even if the library is already being refreshed. ## Values diff --git a/docs/models/operations/friend.md b/docs/models/operations/friend.md new file mode 100644 index 0000000..f163c0c --- /dev/null +++ b/docs/models/operations/friend.md @@ -0,0 +1,19 @@ +# Friend + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `Email` | *string* | :heavy_check_mark: | The account email address | username@email.com | +| `FriendlyName` | *string* | :heavy_check_mark: | The account full name | exampleUser | +| `Home` | *bool* | :heavy_check_mark: | If the account is a Plex Home user | | +| `ID` | *int* | :heavy_check_mark: | The Plex account ID | | +| `Restricted` | **bool* | :heavy_minus_sign: | If the account is a Plex Home managed user | | +| `SharedServers` | [][operations.SharedServers](../../models/operations/sharedservers.md) | :heavy_check_mark: | N/A | | +| `SharedSources` | [][operations.SharedSources](../../models/operations/sharedsources.md) | :heavy_check_mark: | N/A | | +| `Status` | [operations.Status](../../models/operations/status.md) | :heavy_check_mark: | Current friend request status | accepted | +| `Thumb` | *string* | :heavy_check_mark: | URL of the account thumbnail | https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578 | +| `Title` | *string* | :heavy_check_mark: | The title of the account (username or friendly name) | username123 | +| `Username` | *string* | :heavy_check_mark: | The account username | username123 | +| `UUID` | *string* | :heavy_check_mark: | The account Universally Unique Identifier (UUID) | 7d1916e0d8f6e76b | \ No newline at end of file diff --git a/docs/models/operations/geodata.md b/docs/models/operations/geodata.md new file mode 100644 index 0000000..39fe611 --- /dev/null +++ b/docs/models/operations/geodata.md @@ -0,0 +1,20 @@ +# GeoData + +Geo location data + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `Code` | *string* | :heavy_check_mark: | The ISO 3166-1 alpha-2 code of the country. | VI | +| `ContinentCode` | *string* | :heavy_check_mark: | The continent code where the country is located. | NA | +| `Country` | *string* | :heavy_check_mark: | The official name of the country. | United States Virgin Islands | +| `City` | *string* | :heavy_check_mark: | The name of the city. | Amsterdam | +| `EuropeanUnionMember` | **bool* | :heavy_minus_sign: | Indicates if the country is a member of the European Union. | true | +| `TimeZone` | *string* | :heavy_check_mark: | The time zone of the country. | America/St_Thomas | +| `PostalCode` | *int64* | :heavy_check_mark: | The postal code of the location. | 802 | +| `InPrivacyRestrictedCountry` | **bool* | :heavy_minus_sign: | Indicates if the country has privacy restrictions. | true | +| `InPrivacyRestrictedRegion` | **bool* | :heavy_minus_sign: | Indicates if the region has privacy restrictions. | true | +| `Subdivisions` | *string* | :heavy_check_mark: | The name of the primary administrative subdivision. | Saint Thomas | +| `Coordinates` | *string* | :heavy_check_mark: | The geographical coordinates (latitude, longitude) of the location. | 18.3381, -64.8941 | \ No newline at end of file diff --git a/docs/models/operations/getalllibrariesdirectory.md b/docs/models/operations/getalllibrariesdirectory.md new file mode 100644 index 0000000..6d1f048 --- /dev/null +++ b/docs/models/operations/getalllibrariesdirectory.md @@ -0,0 +1,28 @@ +# GetAllLibrariesDirectory + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | true | +| `Art` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg | +| `Composite` | **string* | :heavy_minus_sign: | N/A | /library/sections/1/composite/1705615584 | +| `Filters` | **bool* | :heavy_minus_sign: | N/A | true | +| `Refreshing` | **bool* | :heavy_minus_sign: | N/A | false | +| `Thumb` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie.png | +| `Key` | **string* | :heavy_minus_sign: | N/A | 1 | +| `Type` | **string* | :heavy_minus_sign: | N/A | movie | +| `Title` | **string* | :heavy_minus_sign: | N/A | Movies | +| `Agent` | **string* | :heavy_minus_sign: | N/A | tv.plex.agents.movie | +| `Scanner` | **string* | :heavy_minus_sign: | N/A | Plex Movie | +| `Language` | **string* | :heavy_minus_sign: | N/A | en-US | +| `UUID` | **string* | :heavy_minus_sign: | N/A | 322a231a-b7f7-49f5-920f-14c61199cd30 | +| `UpdatedAt` | **int64* | :heavy_minus_sign: | Unix epoch datetime | 1556281940 | +| `CreatedAt` | **int64* | :heavy_minus_sign: | Unix epoch datetime | 1556281940 | +| `ScannedAt` | **int64* | :heavy_minus_sign: | Unix epoch datetime | 1556281940 | +| `Content` | **bool* | :heavy_minus_sign: | N/A | true | +| `Directory` | **bool* | :heavy_minus_sign: | N/A | true | +| `ContentChangedAt` | **int* | :heavy_minus_sign: | N/A | 3192854 | +| `Hidden` | **int* | :heavy_minus_sign: | N/A | 0 | +| `Location` | [][operations.Location](../../models/operations/location.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getalllibrariesmediacontainer.md b/docs/models/operations/getalllibrariesmediacontainer.md new file mode 100644 index 0000000..ee16049 --- /dev/null +++ b/docs/models/operations/getalllibrariesmediacontainer.md @@ -0,0 +1,11 @@ +# GetAllLibrariesMediaContainer + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Size` | *int* | :heavy_check_mark: | N/A | 5 | +| `AllowSync` | *bool* | :heavy_check_mark: | N/A | false | +| `Title1` | *string* | :heavy_check_mark: | N/A | Plex Library | +| `Directory` | [][operations.GetAllLibrariesDirectory](../../models/operations/getalllibrariesdirectory.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getalllibrariesresponse.md b/docs/models/operations/getalllibrariesresponse.md new file mode 100644 index 0000000..9b07ebc --- /dev/null +++ b/docs/models/operations/getalllibrariesresponse.md @@ -0,0 +1,11 @@ +# GetAllLibrariesResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Object` | [*operations.GetAllLibrariesResponseBody](../../models/operations/getalllibrariesresponsebody.md) | :heavy_minus_sign: | The libraries available on the Server | \ No newline at end of file diff --git a/docs/models/operations/getalllibrariesresponsebody.md b/docs/models/operations/getalllibrariesresponsebody.md new file mode 100644 index 0000000..13a6f10 --- /dev/null +++ b/docs/models/operations/getalllibrariesresponsebody.md @@ -0,0 +1,10 @@ +# GetAllLibrariesResponseBody + +The libraries available on the Server + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `MediaContainer` | [*operations.GetAllLibrariesMediaContainer](../../models/operations/getalllibrariesmediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getbannerimagerequest.md b/docs/models/operations/getbannerimagerequest.md new file mode 100644 index 0000000..5441c94 --- /dev/null +++ b/docs/models/operations/getbannerimagerequest.md @@ -0,0 +1,13 @@ +# GetBannerImageRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `RatingKey` | *int64* | :heavy_check_mark: | the id of the library item to return the children of. | 9518 | +| `Width` | *int64* | :heavy_check_mark: | N/A | 396 | +| `Height` | *int64* | :heavy_check_mark: | N/A | 396 | +| `MinSize` | *int64* | :heavy_check_mark: | N/A | 1 | +| `Upscale` | *int64* | :heavy_check_mark: | N/A | 1 | +| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file diff --git a/docs/models/operations/getbannerimageresponse.md b/docs/models/operations/getbannerimageresponse.md new file mode 100644 index 0000000..4b3ccc6 --- /dev/null +++ b/docs/models/operations/getbannerimageresponse.md @@ -0,0 +1,12 @@ +# GetBannerImageResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ResponseStream` | *io.ReadCloser* | :heavy_minus_sign: | Successful response returning an image | +| `Headers` | map[string][]*string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getcompanionsdataresponse.md b/docs/models/operations/getcompanionsdataresponse.md new file mode 100644 index 0000000..a9d6c3c --- /dev/null +++ b/docs/models/operations/getcompanionsdataresponse.md @@ -0,0 +1,11 @@ +# GetCompanionsDataResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ResponseBodies` | [][operations.ResponseBody](../../models/operations/responsebody.md) | :heavy_minus_sign: | Companions Data | \ No newline at end of file diff --git a/docs/models/operations/getgeodatageodata.md b/docs/models/operations/getgeodatageodata.md new file mode 100644 index 0000000..3917e8f --- /dev/null +++ b/docs/models/operations/getgeodatageodata.md @@ -0,0 +1,20 @@ +# GetGeoDataGeoData + +Geo location data + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `Code` | *string* | :heavy_check_mark: | The ISO 3166-1 alpha-2 code of the country. | VI | +| `ContinentCode` | *string* | :heavy_check_mark: | The continent code where the country is located. | NA | +| `Country` | *string* | :heavy_check_mark: | The official name of the country. | United States Virgin Islands | +| `City` | *string* | :heavy_check_mark: | The name of the city. | Amsterdam | +| `EuropeanUnionMember` | **bool* | :heavy_minus_sign: | Indicates if the country is a member of the European Union. | true | +| `TimeZone` | *string* | :heavy_check_mark: | The time zone of the country. | America/St_Thomas | +| `PostalCode` | *int64* | :heavy_check_mark: | The postal code of the location. | 802 | +| `InPrivacyRestrictedCountry` | **bool* | :heavy_minus_sign: | Indicates if the country has privacy restrictions. | true | +| `InPrivacyRestrictedRegion` | **bool* | :heavy_minus_sign: | Indicates if the region has privacy restrictions. | true | +| `Subdivisions` | *string* | :heavy_check_mark: | The name of the primary administrative subdivision. | Saint Thomas | +| `Coordinates` | *string* | :heavy_check_mark: | The geographical coordinates (latitude, longitude) of the location. | 18.3381, -64.8941 | \ No newline at end of file diff --git a/docs/models/operations/getpinresponsebody.md b/docs/models/operations/getgeodataresponse.md similarity index 57% rename from docs/models/operations/getpinresponsebody.md rename to docs/models/operations/getgeodataresponse.md index 154736b..fffa1ab 100644 --- a/docs/models/operations/getpinresponsebody.md +++ b/docs/models/operations/getgeodataresponse.md @@ -1,21 +1,11 @@ -# GetPinResponseBody - -The Pin +# GetGeoDataResponse ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ID` | **float64* | :heavy_minus_sign: | PinID for use with authentication | 1272322473 | -| `Code` | **string* | :heavy_minus_sign: | N/A | 3patfx1a78ukcbr7x0n9bl26t | -| `Product` | **string* | :heavy_minus_sign: | N/A | Plex Web | -| `Trusted` | **bool* | :heavy_minus_sign: | N/A | | -| `Qr` | **string* | :heavy_minus_sign: | a link to a QR code hosted on plex.tv
The QR code redirects to the relevant `plex.tv/link` authentication page
Which then prompts the user for the 4 Digit Link Pin
| https://plex.tv/api/v2/pins/qr/3patfx1a78ukcbr7x0n9bl26t | -| `ClientIdentifier` | **string* | :heavy_minus_sign: | N/A | Postman | -| `Location` | [*operations.Location](../../models/operations/location.md) | :heavy_minus_sign: | N/A | | -| `ExpiresIn` | **float64* | :heavy_minus_sign: | N/A | 1800 | -| `CreatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | N/A | 2023-04-12 17:00:03 +0000 UTC | -| `ExpiresAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | N/A | 2023-04-12 17:30:03 +0000 UTC | -| `AuthToken` | **string* | :heavy_minus_sign: | N/A | | -| `NewRegistration` | **bool* | :heavy_minus_sign: | N/A | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `GeoData` | [*operations.GetGeoDataGeoData](../../models/operations/getgeodatageodata.md) | :heavy_minus_sign: | Gets the geo location data of the user | {
"code": "VI",
"continent_code": "NA",
"country": "United States Virgin Islands",
"city": "Amsterdam",
"european_union_member": true,
"time_zone": "America/St_Thomas",
"postal_code": 802,
"in_privacy_restricted_country": true,
"in_privacy_restricted_region": true,
"subdivisions": "Saint Thomas",
"coordinates": "18.3381, -64.8941"
} | \ No newline at end of file diff --git a/docs/models/operations/getlibrariesdirectory.md b/docs/models/operations/getlibrariesdirectory.md deleted file mode 100644 index aa4c097..0000000 --- a/docs/models/operations/getlibrariesdirectory.md +++ /dev/null @@ -1,28 +0,0 @@ -# GetLibrariesDirectory - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | true | -| `Art` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg | -| `Composite` | **string* | :heavy_minus_sign: | N/A | /library/sections/1/composite/1705615584 | -| `Filters` | **bool* | :heavy_minus_sign: | N/A | true | -| `Refreshing` | **bool* | :heavy_minus_sign: | N/A | false | -| `Thumb` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie.png | -| `Key` | **string* | :heavy_minus_sign: | N/A | 1 | -| `Type` | **string* | :heavy_minus_sign: | N/A | movie | -| `Title` | **string* | :heavy_minus_sign: | N/A | Movies | -| `Agent` | **string* | :heavy_minus_sign: | N/A | tv.plex.agents.movie | -| `Scanner` | **string* | :heavy_minus_sign: | N/A | Plex Movie | -| `Language` | **string* | :heavy_minus_sign: | N/A | en-US | -| `UUID` | **string* | :heavy_minus_sign: | N/A | 322a231a-b7f7-49f5-920f-14c61199cd30 | -| `UpdatedAt` | **int* | :heavy_minus_sign: | N/A | 1705615634 | -| `CreatedAt` | **int* | :heavy_minus_sign: | N/A | 1654131312 | -| `ScannedAt` | **int* | :heavy_minus_sign: | N/A | 1705615584 | -| `Content` | **bool* | :heavy_minus_sign: | N/A | true | -| `Directory` | **bool* | :heavy_minus_sign: | N/A | true | -| `ContentChangedAt` | **int* | :heavy_minus_sign: | N/A | 3192854 | -| `Hidden` | **int* | :heavy_minus_sign: | N/A | 0 | -| `Location` | [][operations.GetLibrariesLocation](../../models/operations/getlibrarieslocation.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getlibrarieslocation.md b/docs/models/operations/getlibrarieslocation.md deleted file mode 100644 index 1e39992..0000000 --- a/docs/models/operations/getlibrarieslocation.md +++ /dev/null @@ -1,9 +0,0 @@ -# GetLibrariesLocation - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | **int* | :heavy_minus_sign: | N/A | 1 | -| `Path` | **string* | :heavy_minus_sign: | N/A | /movies | \ No newline at end of file diff --git a/docs/models/operations/getlibrariesmediacontainer.md b/docs/models/operations/getlibrariesmediacontainer.md deleted file mode 100644 index e9889e8..0000000 --- a/docs/models/operations/getlibrariesmediacontainer.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetLibrariesMediaContainer - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `Size` | **int* | :heavy_minus_sign: | N/A | 5 | -| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | false | -| `Title1` | **string* | :heavy_minus_sign: | N/A | Plex Library | -| `Directory` | [][operations.GetLibrariesDirectory](../../models/operations/getlibrariesdirectory.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getlibrariesresponse.md b/docs/models/operations/getlibrariesresponse.md deleted file mode 100644 index 8979883..0000000 --- a/docs/models/operations/getlibrariesresponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetLibrariesResponse - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `Object` | [*operations.GetLibrariesResponseBody](../../models/operations/getlibrariesresponsebody.md) | :heavy_minus_sign: | The libraries available on the Server | \ No newline at end of file diff --git a/docs/models/operations/getlibrariesresponsebody.md b/docs/models/operations/getlibrariesresponsebody.md deleted file mode 100644 index c44a4aa..0000000 --- a/docs/models/operations/getlibrariesresponsebody.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetLibrariesResponseBody - -The libraries available on the Server - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| `MediaContainer` | [*operations.GetLibrariesMediaContainer](../../models/operations/getlibrariesmediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getlibrarydirectory.md b/docs/models/operations/getlibrarydetailsdirectory.md similarity index 96% rename from docs/models/operations/getlibrarydirectory.md rename to docs/models/operations/getlibrarydetailsdirectory.md index 917091f..7576d75 100644 --- a/docs/models/operations/getlibrarydirectory.md +++ b/docs/models/operations/getlibrarydetailsdirectory.md @@ -1,4 +1,4 @@ -# GetLibraryDirectory +# GetLibraryDetailsDirectory ## Fields diff --git a/docs/models/operations/getlibraryfilter.md b/docs/models/operations/getlibrarydetailsfilter.md similarity index 97% rename from docs/models/operations/getlibraryfilter.md rename to docs/models/operations/getlibrarydetailsfilter.md index fbcc7dd..c8e35a0 100644 --- a/docs/models/operations/getlibraryfilter.md +++ b/docs/models/operations/getlibrarydetailsfilter.md @@ -1,4 +1,4 @@ -# GetLibraryFilter +# GetLibraryDetailsFilter ## Fields diff --git a/docs/models/operations/getlibrarydetailsmediacontainer.md b/docs/models/operations/getlibrarydetailsmediacontainer.md new file mode 100644 index 0000000..548b847 --- /dev/null +++ b/docs/models/operations/getlibrarydetailsmediacontainer.md @@ -0,0 +1,22 @@ +# GetLibraryDetailsMediaContainer + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Size` | **int* | :heavy_minus_sign: | N/A | 29 | +| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | false | +| `Art` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg | +| `Content` | **string* | :heavy_minus_sign: | N/A | secondary | +| `Identifier` | **string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library | +| `LibrarySectionID` | **int* | :heavy_minus_sign: | N/A | 1 | +| `MediaTagPrefix` | **string* | :heavy_minus_sign: | N/A | /system/bundle/media/flags/ | +| `MediaTagVersion` | **int* | :heavy_minus_sign: | N/A | 1701731894 | +| `Thumb` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie.png | +| `Title1` | **string* | :heavy_minus_sign: | N/A | Movies | +| `ViewGroup` | **string* | :heavy_minus_sign: | N/A | secondary | +| `ViewMode` | **int* | :heavy_minus_sign: | N/A | 65592 | +| `Directory` | [][operations.GetLibraryDetailsDirectory](../../models/operations/getlibrarydetailsdirectory.md) | :heavy_minus_sign: | N/A | | +| `Type` | [][operations.GetLibraryDetailsType](../../models/operations/getlibrarydetailstype.md) | :heavy_minus_sign: | N/A | | +| `FieldType` | [][operations.FieldType](../../models/operations/fieldtype.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getlibraryrequest.md b/docs/models/operations/getlibrarydetailsrequest.md similarity index 89% rename from docs/models/operations/getlibraryrequest.md rename to docs/models/operations/getlibrarydetailsrequest.md index 10942cd..92a3a94 100644 --- a/docs/models/operations/getlibraryrequest.md +++ b/docs/models/operations/getlibrarydetailsrequest.md @@ -1,9 +1,9 @@ -# GetLibraryRequest +# GetLibraryDetailsRequest ## Fields | Field | Type | Required | Description | Example | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `SectionID` | *float64* | :heavy_check_mark: | the Id of the library to query | 1000 | +| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | | `IncludeDetails` | [*operations.IncludeDetails](../../models/operations/includedetails.md) | :heavy_minus_sign: | Whether or not to include details for a section (types, filters, and sorts).
Only exists for backwards compatibility, media providers other than the server libraries have it on always.
| | \ No newline at end of file diff --git a/docs/models/operations/getlibrarydetailsresponse.md b/docs/models/operations/getlibrarydetailsresponse.md new file mode 100644 index 0000000..2a37d4e --- /dev/null +++ b/docs/models/operations/getlibrarydetailsresponse.md @@ -0,0 +1,11 @@ +# GetLibraryDetailsResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Object` | [*operations.GetLibraryDetailsResponseBody](../../models/operations/getlibrarydetailsresponsebody.md) | :heavy_minus_sign: | The details of the library | \ No newline at end of file diff --git a/docs/models/operations/getlibrarydetailsresponsebody.md b/docs/models/operations/getlibrarydetailsresponsebody.md new file mode 100644 index 0000000..1cc3f99 --- /dev/null +++ b/docs/models/operations/getlibrarydetailsresponsebody.md @@ -0,0 +1,10 @@ +# GetLibraryDetailsResponseBody + +The details of the library + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| `MediaContainer` | [*operations.GetLibraryDetailsMediaContainer](../../models/operations/getlibrarydetailsmediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getlibrarydetailstype.md b/docs/models/operations/getlibrarydetailstype.md new file mode 100644 index 0000000..8d03c05 --- /dev/null +++ b/docs/models/operations/getlibrarydetailstype.md @@ -0,0 +1,14 @@ +# GetLibraryDetailsType + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `Key` | **string* | :heavy_minus_sign: | N/A | /library/sections/1/all?type=1 | +| `Type` | **string* | :heavy_minus_sign: | N/A | movie | +| `Title` | **string* | :heavy_minus_sign: | N/A | Movies | +| `Active` | **bool* | :heavy_minus_sign: | N/A | false | +| `Filter` | [][operations.GetLibraryDetailsFilter](../../models/operations/getlibrarydetailsfilter.md) | :heavy_minus_sign: | N/A | | +| `Sort` | [][operations.Sort](../../models/operations/sort.md) | :heavy_minus_sign: | N/A | | +| `Field` | [][operations.Field](../../models/operations/field.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getlibraryitemsrequest.md b/docs/models/operations/getlibraryitemsrequest.md index 305d69d..dd03faa 100644 --- a/docs/models/operations/getlibraryitemsrequest.md +++ b/docs/models/operations/getlibraryitemsrequest.md @@ -3,8 +3,12 @@ ## Fields -| Field | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `SectionID` | *any* | :heavy_check_mark: | the Id of the library to query | | -| `Tag` | [operations.Tag](../../models/operations/tag.md) | :heavy_check_mark: | A key representing a specific tag within the section. | | -| `IncludeGuids` | **int64* | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | +| `Tag` | [operations.Tag](../../models/operations/tag.md) | :heavy_check_mark: | A key representing a specific tag within the section. | | +| `IncludeGuids` | [*operations.IncludeGuids](../../models/operations/includeguids.md) | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | +| `IncludeMeta` | [*operations.IncludeMeta](../../models/operations/includemeta.md) | :heavy_minus_sign: | Adds the Meta object to the response
| 1 | +| `Type` | [operations.Type](../../models/operations/type.md) | :heavy_check_mark: | The type of media to retrieve.
1 = movie
2 = show
3 = season
4 = episode
E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
| 2 | +| `XPlexContainerStart` | **int* | :heavy_minus_sign: | The index of the first item to return. If not specified, the first item will be returned.
If the number of items exceeds the limit, the response will be paginated.
By default this is 0
| 0 | +| `XPlexContainerSize` | **int* | :heavy_minus_sign: | The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
By default this is 50
| 50 | \ No newline at end of file diff --git a/docs/models/operations/getlibrarymediacontainer.md b/docs/models/operations/getlibrarymediacontainer.md deleted file mode 100644 index 083a111..0000000 --- a/docs/models/operations/getlibrarymediacontainer.md +++ /dev/null @@ -1,22 +0,0 @@ -# GetLibraryMediaContainer - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `Size` | **int* | :heavy_minus_sign: | N/A | 29 | -| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | false | -| `Art` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie-fanart.jpg | -| `Content` | **string* | :heavy_minus_sign: | N/A | secondary | -| `Identifier` | **string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library | -| `LibrarySectionID` | **int* | :heavy_minus_sign: | N/A | 1 | -| `MediaTagPrefix` | **string* | :heavy_minus_sign: | N/A | /system/bundle/media/flags/ | -| `MediaTagVersion` | **int* | :heavy_minus_sign: | N/A | 1701731894 | -| `Thumb` | **string* | :heavy_minus_sign: | N/A | /:/resources/movie.png | -| `Title1` | **string* | :heavy_minus_sign: | N/A | Movies | -| `ViewGroup` | **string* | :heavy_minus_sign: | N/A | secondary | -| `ViewMode` | **int* | :heavy_minus_sign: | N/A | 65592 | -| `Directory` | [][operations.GetLibraryDirectory](../../models/operations/getlibrarydirectory.md) | :heavy_minus_sign: | N/A | | -| `Type` | [][operations.GetLibraryType](../../models/operations/getlibrarytype.md) | :heavy_minus_sign: | N/A | | -| `FieldType` | [][operations.FieldType](../../models/operations/fieldtype.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getlibraryresponse.md b/docs/models/operations/getlibraryresponse.md deleted file mode 100644 index 1f3e22f..0000000 --- a/docs/models/operations/getlibraryresponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetLibraryResponse - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `Object` | [*operations.GetLibraryResponseBody](../../models/operations/getlibraryresponsebody.md) | :heavy_minus_sign: | The details of the library | \ No newline at end of file diff --git a/docs/models/operations/getlibraryresponsebody.md b/docs/models/operations/getlibraryresponsebody.md deleted file mode 100644 index 4474dbb..0000000 --- a/docs/models/operations/getlibraryresponsebody.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetLibraryResponseBody - -The details of the library - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | -| `MediaContainer` | [*operations.GetLibraryMediaContainer](../../models/operations/getlibrarymediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getlibrarytype.md b/docs/models/operations/getlibrarytype.md deleted file mode 100644 index e46085b..0000000 --- a/docs/models/operations/getlibrarytype.md +++ /dev/null @@ -1,14 +0,0 @@ -# GetLibraryType - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `Key` | **string* | :heavy_minus_sign: | N/A | /library/sections/1/all?type=1 | -| `Type` | **string* | :heavy_minus_sign: | N/A | movie | -| `Title` | **string* | :heavy_minus_sign: | N/A | Movies | -| `Active` | **bool* | :heavy_minus_sign: | N/A | false | -| `Filter` | [][operations.GetLibraryFilter](../../models/operations/getlibraryfilter.md) | :heavy_minus_sign: | N/A | | -| `Sort` | [][operations.Sort](../../models/operations/sort.md) | :heavy_minus_sign: | N/A | | -| `Field` | [][operations.Field](../../models/operations/field.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getmediaprovidersdirectory.md b/docs/models/operations/getmediaprovidersdirectory.md new file mode 100644 index 0000000..eacc1a5 --- /dev/null +++ b/docs/models/operations/getmediaprovidersdirectory.md @@ -0,0 +1,21 @@ +# GetMediaProvidersDirectory + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `HubKey` | **string* | :heavy_minus_sign: | N/A | +| `Title` | **string* | :heavy_minus_sign: | N/A | +| `Agent` | **string* | :heavy_minus_sign: | N/A | +| `Language` | **string* | :heavy_minus_sign: | N/A | +| `Refreshing` | **bool* | :heavy_minus_sign: | N/A | +| `Scanner` | **string* | :heavy_minus_sign: | N/A | +| `UUID` | **string* | :heavy_minus_sign: | N/A | +| `ID` | **string* | :heavy_minus_sign: | N/A | +| `Key` | **string* | :heavy_minus_sign: | N/A | +| `Type` | **string* | :heavy_minus_sign: | N/A | +| `Subtype` | **string* | :heavy_minus_sign: | N/A | +| `UpdatedAt` | **int64* | :heavy_minus_sign: | N/A | +| `ScannedAt` | **int64* | :heavy_minus_sign: | N/A | +| `Pivot` | [][operations.Pivot](../../models/operations/pivot.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getmediaprovidersmediacontainer.md b/docs/models/operations/getmediaprovidersmediacontainer.md new file mode 100644 index 0000000..15e012a --- /dev/null +++ b/docs/models/operations/getmediaprovidersmediacontainer.md @@ -0,0 +1,51 @@ +# GetMediaProvidersMediaContainer + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `Size` | **int64* | :heavy_minus_sign: | N/A | +| `AllowCameraUpload` | **bool* | :heavy_minus_sign: | N/A | +| `AllowChannelAccess` | **bool* | :heavy_minus_sign: | N/A | +| `AllowSharing` | **bool* | :heavy_minus_sign: | N/A | +| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | +| `AllowTuners` | **bool* | :heavy_minus_sign: | N/A | +| `BackgroundProcessing` | **bool* | :heavy_minus_sign: | N/A | +| `Certificate` | **bool* | :heavy_minus_sign: | N/A | +| `CompanionProxy` | **bool* | :heavy_minus_sign: | N/A | +| `CountryCode` | **string* | :heavy_minus_sign: | N/A | +| `Diagnostics` | **string* | :heavy_minus_sign: | N/A | +| `EventStream` | **bool* | :heavy_minus_sign: | N/A | +| `FriendlyName` | **string* | :heavy_minus_sign: | N/A | +| `Livetv` | **int64* | :heavy_minus_sign: | N/A | +| `MachineIdentifier` | **string* | :heavy_minus_sign: | N/A | +| `MusicAnalysis` | **int64* | :heavy_minus_sign: | N/A | +| `MyPlex` | **bool* | :heavy_minus_sign: | N/A | +| `MyPlexMappingState` | **string* | :heavy_minus_sign: | N/A | +| `MyPlexSigninState` | **string* | :heavy_minus_sign: | N/A | +| `MyPlexSubscription` | **bool* | :heavy_minus_sign: | N/A | +| `MyPlexUsername` | **string* | :heavy_minus_sign: | N/A | +| `OfflineTranscode` | **int64* | :heavy_minus_sign: | N/A | +| `OwnerFeatures` | **string* | :heavy_minus_sign: | N/A | +| `Platform` | **string* | :heavy_minus_sign: | N/A | +| `PlatformVersion` | **string* | :heavy_minus_sign: | N/A | +| `PluginHost` | **bool* | :heavy_minus_sign: | N/A | +| `PushNotifications` | **bool* | :heavy_minus_sign: | N/A | +| `ReadOnlyLibraries` | **bool* | :heavy_minus_sign: | N/A | +| `StreamingBrainABRVersion` | **int64* | :heavy_minus_sign: | N/A | +| `StreamingBrainVersion` | **int64* | :heavy_minus_sign: | N/A | +| `Sync` | **bool* | :heavy_minus_sign: | N/A | +| `TranscoderActiveVideoSessions` | **int64* | :heavy_minus_sign: | N/A | +| `TranscoderAudio` | **bool* | :heavy_minus_sign: | N/A | +| `TranscoderLyrics` | **bool* | :heavy_minus_sign: | N/A | +| `TranscoderSubtitles` | **bool* | :heavy_minus_sign: | N/A | +| `TranscoderVideo` | **bool* | :heavy_minus_sign: | N/A | +| `TranscoderVideoBitrates` | **string* | :heavy_minus_sign: | N/A | +| `TranscoderVideoQualities` | **string* | :heavy_minus_sign: | N/A | +| `TranscoderVideoResolutions` | **string* | :heavy_minus_sign: | N/A | +| `UpdatedAt` | **int64* | :heavy_minus_sign: | N/A | +| `Updater` | **bool* | :heavy_minus_sign: | N/A | +| `Version` | **string* | :heavy_minus_sign: | N/A | +| `VoiceSearch` | **bool* | :heavy_minus_sign: | N/A | +| `MediaProvider` | [][operations.MediaProvider](../../models/operations/mediaprovider.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getmediaprovidersrequest.md b/docs/models/operations/getmediaprovidersrequest.md new file mode 100644 index 0000000..2466085 --- /dev/null +++ b/docs/models/operations/getmediaprovidersrequest.md @@ -0,0 +1,8 @@ +# GetMediaProvidersRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------- | ------------------------- | ------------------------- | ------------------------- | ------------------------- | +| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file diff --git a/docs/models/operations/getmediaprovidersresponse.md b/docs/models/operations/getmediaprovidersresponse.md new file mode 100644 index 0000000..d165337 --- /dev/null +++ b/docs/models/operations/getmediaprovidersresponse.md @@ -0,0 +1,11 @@ +# GetMediaProvidersResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Object` | [*operations.GetMediaProvidersResponseBody](../../models/operations/getmediaprovidersresponsebody.md) | :heavy_minus_sign: | Media providers and their features | \ No newline at end of file diff --git a/docs/models/operations/getmediaprovidersresponsebody.md b/docs/models/operations/getmediaprovidersresponsebody.md new file mode 100644 index 0000000..c23aa89 --- /dev/null +++ b/docs/models/operations/getmediaprovidersresponsebody.md @@ -0,0 +1,10 @@ +# GetMediaProvidersResponseBody + +Media providers and their features + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| `MediaContainer` | [*operations.GetMediaProvidersMediaContainer](../../models/operations/getmediaprovidersmediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getmetadatacountry.md b/docs/models/operations/getmetadatabyratingkeycountry.md similarity index 95% rename from docs/models/operations/getmetadatacountry.md rename to docs/models/operations/getmetadatabyratingkeycountry.md index 30cd3cb..362fe10 100644 --- a/docs/models/operations/getmetadatacountry.md +++ b/docs/models/operations/getmetadatabyratingkeycountry.md @@ -1,4 +1,4 @@ -# GetMetadataCountry +# GetMetaDataByRatingKeyCountry ## Fields diff --git a/docs/models/operations/getmetadatadirector.md b/docs/models/operations/getmetadatabyratingkeydirector.md similarity index 98% rename from docs/models/operations/getmetadatadirector.md rename to docs/models/operations/getmetadatabyratingkeydirector.md index cf47e9f..4aa972d 100644 --- a/docs/models/operations/getmetadatadirector.md +++ b/docs/models/operations/getmetadatabyratingkeydirector.md @@ -1,4 +1,4 @@ -# GetMetadataDirector +# GetMetaDataByRatingKeyDirector ## Fields diff --git a/docs/models/operations/getmetadatagenre.md b/docs/models/operations/getmetadatabyratingkeygenre.md similarity index 94% rename from docs/models/operations/getmetadatagenre.md rename to docs/models/operations/getmetadatabyratingkeygenre.md index 20e5f2b..c929bc8 100644 --- a/docs/models/operations/getmetadatagenre.md +++ b/docs/models/operations/getmetadatabyratingkeygenre.md @@ -1,4 +1,4 @@ -# GetMetadataGenre +# GetMetaDataByRatingKeyGenre ## Fields diff --git a/docs/models/operations/getmetadatabyratingkeymedia.md b/docs/models/operations/getmetadatabyratingkeymedia.md new file mode 100644 index 0000000..4a2f4fa --- /dev/null +++ b/docs/models/operations/getmetadatabyratingkeymedia.md @@ -0,0 +1,24 @@ +# GetMetaDataByRatingKeyMedia + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `ID` | **int* | :heavy_minus_sign: | N/A | 15 | +| `Duration` | **int* | :heavy_minus_sign: | N/A | 141417 | +| `Bitrate` | **int* | :heavy_minus_sign: | N/A | 2278 | +| `Width` | **int* | :heavy_minus_sign: | N/A | 1920 | +| `Height` | **int* | :heavy_minus_sign: | N/A | 814 | +| `AspectRatio` | **float64* | :heavy_minus_sign: | N/A | 2.35 | +| `AudioChannels` | **int* | :heavy_minus_sign: | N/A | 2 | +| `AudioCodec` | **string* | :heavy_minus_sign: | N/A | aac | +| `VideoCodec` | **string* | :heavy_minus_sign: | N/A | h264 | +| `VideoResolution` | **string* | :heavy_minus_sign: | N/A | 1080 | +| `Container` | **string* | :heavy_minus_sign: | N/A | mp4 | +| `VideoFrameRate` | **string* | :heavy_minus_sign: | N/A | 24p | +| `OptimizedForStreaming` | **int* | :heavy_minus_sign: | N/A | 0 | +| `AudioProfile` | **string* | :heavy_minus_sign: | N/A | lc | +| `Has64bitOffsets` | **bool* | :heavy_minus_sign: | N/A | false | +| `VideoProfile` | **string* | :heavy_minus_sign: | N/A | high | +| `Part` | [][operations.GetMetaDataByRatingKeyPart](../../models/operations/getmetadatabyratingkeypart.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getmetadatabyratingkeymediacontainer.md b/docs/models/operations/getmetadatabyratingkeymediacontainer.md new file mode 100644 index 0000000..70b75f5 --- /dev/null +++ b/docs/models/operations/getmetadatabyratingkeymediacontainer.md @@ -0,0 +1,16 @@ +# GetMetaDataByRatingKeyMediaContainer + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `Size` | **int* | :heavy_minus_sign: | N/A | 1 | +| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | true | +| `Identifier` | **string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library | +| `LibrarySectionID` | **int* | :heavy_minus_sign: | N/A | 1 | +| `LibrarySectionTitle` | **string* | :heavy_minus_sign: | N/A | Movies | +| `LibrarySectionUUID` | **string* | :heavy_minus_sign: | N/A | cfc899d7-3000-46f6-8489-b9592714ada5 | +| `MediaTagPrefix` | **string* | :heavy_minus_sign: | N/A | /system/bundle/media/flags/ | +| `MediaTagVersion` | **int* | :heavy_minus_sign: | N/A | 1698860922 | +| `Metadata` | [][operations.GetMetaDataByRatingKeyMetadata](../../models/operations/getmetadatabyratingkeymetadata.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getmetadatametadata.md b/docs/models/operations/getmetadatabyratingkeymetadata.md similarity index 98% rename from docs/models/operations/getmetadatametadata.md rename to docs/models/operations/getmetadatabyratingkeymetadata.md index 21c2c43..6d9892d 100644 --- a/docs/models/operations/getmetadatametadata.md +++ b/docs/models/operations/getmetadatabyratingkeymetadata.md @@ -1,4 +1,4 @@ -# GetMetadataMetadata +# GetMetaDataByRatingKeyMetadata ## Fields @@ -29,12 +29,12 @@ | `AudienceRatingImage` | **string* | :heavy_minus_sign: | N/A | rottentomatoes://image.rating.upright | | `HasPremiumPrimaryExtra` | **string* | :heavy_minus_sign: | N/A | 1 | | `RatingImage` | **string* | :heavy_minus_sign: | N/A | rottentomatoes://image.rating.ripe | -| `Media` | [][operations.GetMetadataMedia](../../models/operations/getmetadatamedia.md) | :heavy_minus_sign: | N/A | | -| `Genre` | [][operations.GetMetadataGenre](../../models/operations/getmetadatagenre.md) | :heavy_minus_sign: | N/A | | -| `Country` | [][operations.GetMetadataCountry](../../models/operations/getmetadatacountry.md) | :heavy_minus_sign: | N/A | | +| `Media` | [][operations.GetMetaDataByRatingKeyMedia](../../models/operations/getmetadatabyratingkeymedia.md) | :heavy_minus_sign: | N/A | | +| `Genre` | [][operations.GetMetaDataByRatingKeyGenre](../../models/operations/getmetadatabyratingkeygenre.md) | :heavy_minus_sign: | N/A | | +| `Country` | [][operations.GetMetaDataByRatingKeyCountry](../../models/operations/getmetadatabyratingkeycountry.md) | :heavy_minus_sign: | N/A | | | `Guids` | [][operations.Guids](../../models/operations/guids.md) | :heavy_minus_sign: | N/A | | | `Ratings` | [][operations.Ratings](../../models/operations/ratings.md) | :heavy_minus_sign: | N/A | | -| `Director` | [][operations.GetMetadataDirector](../../models/operations/getmetadatadirector.md) | :heavy_minus_sign: | N/A | | -| `Writer` | [][operations.GetMetadataWriter](../../models/operations/getmetadatawriter.md) | :heavy_minus_sign: | N/A | | -| `Role` | [][operations.GetMetadataRole](../../models/operations/getmetadatarole.md) | :heavy_minus_sign: | N/A | | +| `Director` | [][operations.GetMetaDataByRatingKeyDirector](../../models/operations/getmetadatabyratingkeydirector.md) | :heavy_minus_sign: | N/A | | +| `Writer` | [][operations.GetMetaDataByRatingKeyWriter](../../models/operations/getmetadatabyratingkeywriter.md) | :heavy_minus_sign: | N/A | | +| `Role` | [][operations.GetMetaDataByRatingKeyRole](../../models/operations/getmetadatabyratingkeyrole.md) | :heavy_minus_sign: | N/A | | | `Producer` | [][operations.Producer](../../models/operations/producer.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getmetadatapart.md b/docs/models/operations/getmetadatabyratingkeypart.md similarity index 99% rename from docs/models/operations/getmetadatapart.md rename to docs/models/operations/getmetadatabyratingkeypart.md index 8cae986..45baf9c 100644 --- a/docs/models/operations/getmetadatapart.md +++ b/docs/models/operations/getmetadatabyratingkeypart.md @@ -1,4 +1,4 @@ -# GetMetadataPart +# GetMetaDataByRatingKeyPart ## Fields diff --git a/docs/models/operations/getmetadatarequest.md b/docs/models/operations/getmetadatabyratingkeyrequest.md similarity index 51% rename from docs/models/operations/getmetadatarequest.md rename to docs/models/operations/getmetadatabyratingkeyrequest.md index 23c6eb8..4adaf3d 100644 --- a/docs/models/operations/getmetadatarequest.md +++ b/docs/models/operations/getmetadatabyratingkeyrequest.md @@ -1,8 +1,8 @@ -# GetMetadataRequest +# GetMetaDataByRatingKeyRequest ## Fields -| Field | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `RatingKey` | *float64* | :heavy_check_mark: | the id of the library item to return the children of. | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `RatingKey` | *int64* | :heavy_check_mark: | the id of the library item to return the children of. | 9518 | \ No newline at end of file diff --git a/docs/models/operations/getmetadatabyratingkeyresponse.md b/docs/models/operations/getmetadatabyratingkeyresponse.md new file mode 100644 index 0000000..c7ac9bd --- /dev/null +++ b/docs/models/operations/getmetadatabyratingkeyresponse.md @@ -0,0 +1,11 @@ +# GetMetaDataByRatingKeyResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Object` | [*operations.GetMetaDataByRatingKeyResponseBody](../../models/operations/getmetadatabyratingkeyresponsebody.md) | :heavy_minus_sign: | The metadata of the library item. | \ No newline at end of file diff --git a/docs/models/operations/getmetadatabyratingkeyresponsebody.md b/docs/models/operations/getmetadatabyratingkeyresponsebody.md new file mode 100644 index 0000000..a8e3b31 --- /dev/null +++ b/docs/models/operations/getmetadatabyratingkeyresponsebody.md @@ -0,0 +1,10 @@ +# GetMetaDataByRatingKeyResponseBody + +The metadata of the library item. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| `MediaContainer` | [*operations.GetMetaDataByRatingKeyMediaContainer](../../models/operations/getmetadatabyratingkeymediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getmetadatarole.md b/docs/models/operations/getmetadatabyratingkeyrole.md similarity index 99% rename from docs/models/operations/getmetadatarole.md rename to docs/models/operations/getmetadatabyratingkeyrole.md index f1d0380..ae10c16 100644 --- a/docs/models/operations/getmetadatarole.md +++ b/docs/models/operations/getmetadatabyratingkeyrole.md @@ -1,4 +1,4 @@ -# GetMetadataRole +# GetMetaDataByRatingKeyRole ## Fields diff --git a/docs/models/operations/getmetadatawriter.md b/docs/models/operations/getmetadatabyratingkeywriter.md similarity index 98% rename from docs/models/operations/getmetadatawriter.md rename to docs/models/operations/getmetadatabyratingkeywriter.md index ac7ebd5..ea03bef 100644 --- a/docs/models/operations/getmetadatawriter.md +++ b/docs/models/operations/getmetadatabyratingkeywriter.md @@ -1,4 +1,4 @@ -# GetMetadataWriter +# GetMetaDataByRatingKeyWriter ## Fields diff --git a/docs/models/operations/getmetadatamedia.md b/docs/models/operations/getmetadatamedia.md deleted file mode 100644 index 5a79d56..0000000 --- a/docs/models/operations/getmetadatamedia.md +++ /dev/null @@ -1,24 +0,0 @@ -# GetMetadataMedia - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `ID` | **int* | :heavy_minus_sign: | N/A | 15 | -| `Duration` | **int* | :heavy_minus_sign: | N/A | 141417 | -| `Bitrate` | **int* | :heavy_minus_sign: | N/A | 2278 | -| `Width` | **int* | :heavy_minus_sign: | N/A | 1920 | -| `Height` | **int* | :heavy_minus_sign: | N/A | 814 | -| `AspectRatio` | **float64* | :heavy_minus_sign: | N/A | 2.35 | -| `AudioChannels` | **int* | :heavy_minus_sign: | N/A | 2 | -| `AudioCodec` | **string* | :heavy_minus_sign: | N/A | aac | -| `VideoCodec` | **string* | :heavy_minus_sign: | N/A | h264 | -| `VideoResolution` | **string* | :heavy_minus_sign: | N/A | 1080 | -| `Container` | **string* | :heavy_minus_sign: | N/A | mp4 | -| `VideoFrameRate` | **string* | :heavy_minus_sign: | N/A | 24p | -| `OptimizedForStreaming` | **int* | :heavy_minus_sign: | N/A | 0 | -| `AudioProfile` | **string* | :heavy_minus_sign: | N/A | lc | -| `Has64bitOffsets` | **bool* | :heavy_minus_sign: | N/A | false | -| `VideoProfile` | **string* | :heavy_minus_sign: | N/A | high | -| `Part` | [][operations.GetMetadataPart](../../models/operations/getmetadatapart.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getmetadatamediacontainer.md b/docs/models/operations/getmetadatamediacontainer.md deleted file mode 100644 index 607e8c9..0000000 --- a/docs/models/operations/getmetadatamediacontainer.md +++ /dev/null @@ -1,16 +0,0 @@ -# GetMetadataMediaContainer - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `Size` | **int* | :heavy_minus_sign: | N/A | 1 | -| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | true | -| `Identifier` | **string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library | -| `LibrarySectionID` | **int* | :heavy_minus_sign: | N/A | 1 | -| `LibrarySectionTitle` | **string* | :heavy_minus_sign: | N/A | Movies | -| `LibrarySectionUUID` | **string* | :heavy_minus_sign: | N/A | cfc899d7-3000-46f6-8489-b9592714ada5 | -| `MediaTagPrefix` | **string* | :heavy_minus_sign: | N/A | /system/bundle/media/flags/ | -| `MediaTagVersion` | **int* | :heavy_minus_sign: | N/A | 1698860922 | -| `Metadata` | [][operations.GetMetadataMetadata](../../models/operations/getmetadatametadata.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getmetadataresponse.md b/docs/models/operations/getmetadataresponse.md deleted file mode 100644 index 517cf11..0000000 --- a/docs/models/operations/getmetadataresponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetMetadataResponse - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `Object` | [*operations.GetMetadataResponseBody](../../models/operations/getmetadataresponsebody.md) | :heavy_minus_sign: | The metadata of the library item. | \ No newline at end of file diff --git a/docs/models/operations/getmetadataresponsebody.md b/docs/models/operations/getmetadataresponsebody.md deleted file mode 100644 index d5552ba..0000000 --- a/docs/models/operations/getmetadataresponsebody.md +++ /dev/null @@ -1,10 +0,0 @@ -# GetMetadataResponseBody - -The metadata of the library item. - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `MediaContainer` | [*operations.GetMetadataMediaContainer](../../models/operations/getmetadatamediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getpinauthpincontainer.md b/docs/models/operations/getpinauthpincontainer.md new file mode 100644 index 0000000..88bd2aa --- /dev/null +++ b/docs/models/operations/getpinauthpincontainer.md @@ -0,0 +1,21 @@ +# GetPinAuthPinContainer + +Requests a new pin id used in the authentication flow + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | *int64* | :heavy_check_mark: | N/A | 308667304 | +| `Code` | *string* | :heavy_check_mark: | N/A | 7RQZ | +| `Product` | *string* | :heavy_check_mark: | N/A | 0 | +| `Trusted` | **bool* | :heavy_minus_sign: | N/A | | +| `Qr` | *string* | :heavy_check_mark: | N/A | https://plex.tv/api/v2/pins/qr/7RQZ | +| `ClientIdentifier` | *string* | :heavy_check_mark: | The X-Client-Identifier used in the request | | +| `Location` | [operations.GeoData](../../models/operations/geodata.md) | :heavy_check_mark: | Geo location data | {
"code": "VI",
"continent_code": "NA",
"country": "United States Virgin Islands",
"city": "Amsterdam",
"european_union_member": true,
"time_zone": "America/St_Thomas",
"postal_code": 802,
"in_privacy_restricted_country": true,
"in_privacy_restricted_region": true,
"subdivisions": "Saint Thomas",
"coordinates": "18.3381, -64.8941"
} | +| `ExpiresIn` | **int64* | :heavy_minus_sign: | The number of seconds this pin expires, by default 900 seconds | 876 | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | 2024-07-16T17:03:05Z | +| `ExpiresAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | 2024-07-16T17:18:05Z | +| `AuthToken` | *any* | :heavy_minus_sign: | N/A | | +| `NewRegistration` | *any* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/getpinglobals.md b/docs/models/operations/getpinglobals.md index 9b83ca7..b81b71c 100644 --- a/docs/models/operations/getpinglobals.md +++ b/docs/models/operations/getpinglobals.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | \ No newline at end of file +| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | \ No newline at end of file diff --git a/docs/models/operations/getpinrequest.md b/docs/models/operations/getpinrequest.md index c9a989e..3b4713e 100644 --- a/docs/models/operations/getpinrequest.md +++ b/docs/models/operations/getpinrequest.md @@ -6,5 +6,5 @@ | 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`
| | -| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | -| `XPlexProduct` | *string* | :heavy_check_mark: | Product name of the application shown in the list of devices
| Postman | \ No newline at end of file +| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | +| `XPlexProduct` | **string* | :heavy_minus_sign: | N/A | Plex Web | \ No newline at end of file diff --git a/docs/models/operations/getpinresponse.md b/docs/models/operations/getpinresponse.md index 3dbdeea..8ce7a22 100644 --- a/docs/models/operations/getpinresponse.md +++ b/docs/models/operations/getpinresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `Object` | [*operations.GetPinResponseBody](../../models/operations/getpinresponsebody.md) | :heavy_minus_sign: | The Pin | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `AuthPinContainer` | [*operations.GetPinAuthPinContainer](../../models/operations/getpinauthpincontainer.md) | :heavy_minus_sign: | Requests a new pin id used in the authentication flow | {
"id": 308667304,
"code": "7RQZ",
"product": "0",
"trusted": false,
"qr": "https://plex.tv/api/v2/pins/qr/7RQZ",
"clientIdentifier": "string",
"location": {
"code": "VI",
"continent_code": "NA",
"country": "United States Virgin Islands",
"city": "Amsterdam",
"european_union_member": true,
"time_zone": "America/St_Thomas",
"postal_code": 802,
"in_privacy_restricted_country": true,
"in_privacy_restricted_region": true,
"subdivisions": "Saint Thomas",
"coordinates": "18.3381, -64.8941"
},
"expiresIn": 876,
"createdAt": "2024-07-16T17:03:05Z",
"expiresAt": "2024-07-16T17:18:05Z",
"authToken": null,
"newRegistration": null
} | \ No newline at end of file diff --git a/docs/models/operations/getplaylistcontentsqueryparamtype.md b/docs/models/operations/getplaylistcontentsqueryparamtype.md new file mode 100644 index 0000000..dfa0e01 --- /dev/null +++ b/docs/models/operations/getplaylistcontentsqueryparamtype.md @@ -0,0 +1,19 @@ +# GetPlaylistContentsQueryParamType + +The type of media to retrieve. +1 = movie +2 = show +3 = season +4 = episode +E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries + + + +## Values + +| Name | Value | +| ---------------------------------------- | ---------------------------------------- | +| `GetPlaylistContentsQueryParamTypeOne` | 1 | +| `GetPlaylistContentsQueryParamTypeTwo` | 2 | +| `GetPlaylistContentsQueryParamTypeThree` | 3 | +| `GetPlaylistContentsQueryParamTypeFour` | 4 | \ No newline at end of file diff --git a/docs/models/operations/getplaylistcontentsrequest.md b/docs/models/operations/getplaylistcontentsrequest.md index afa2ce8..15c6fc5 100644 --- a/docs/models/operations/getplaylistcontentsrequest.md +++ b/docs/models/operations/getplaylistcontentsrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------- | --------------------------------------- | --------------------------------------- | --------------------------------------- | -| `PlaylistID` | *float64* | :heavy_check_mark: | the ID of the playlist | -| `Type` | *float64* | :heavy_check_mark: | the metadata type of the item to return | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `PlaylistID` | *float64* | :heavy_check_mark: | the ID of the playlist | | +| `Type` | [operations.GetPlaylistContentsQueryParamType](../../models/operations/getplaylistcontentsqueryparamtype.md) | :heavy_check_mark: | The type of media to retrieve.
1 = movie
2 = show
3 = season
4 = episode
E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
| 2 | \ No newline at end of file diff --git a/docs/models/operations/getrecentlyaddedrequest.md b/docs/models/operations/getrecentlyaddedrequest.md new file mode 100644 index 0000000..4e3a9e5 --- /dev/null +++ b/docs/models/operations/getrecentlyaddedrequest.md @@ -0,0 +1,9 @@ +# GetRecentlyAddedRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `XPlexContainerStart` | **int* | :heavy_minus_sign: | The index of the first item to return. If not specified, the first item will be returned.
If the number of items exceeds the limit, the response will be paginated.
By default this is 0
| 0 | +| `XPlexContainerSize` | **int* | :heavy_minus_sign: | The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
By default this is 50
| 50 | \ No newline at end of file diff --git a/docs/models/operations/getrefreshlibrarymetadatarequest.md b/docs/models/operations/getrefreshlibrarymetadatarequest.md new file mode 100644 index 0000000..10044a8 --- /dev/null +++ b/docs/models/operations/getrefreshlibrarymetadatarequest.md @@ -0,0 +1,9 @@ +# GetRefreshLibraryMetadataRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | +| `Force` | [*operations.Force](../../models/operations/force.md) | :heavy_minus_sign: | Force the refresh even if the library is already being refreshed. | 0 | \ No newline at end of file diff --git a/docs/models/operations/refreshlibraryresponse.md b/docs/models/operations/getrefreshlibrarymetadataresponse.md similarity index 97% rename from docs/models/operations/refreshlibraryresponse.md rename to docs/models/operations/getrefreshlibrarymetadataresponse.md index 92d8634..1c8e65f 100644 --- a/docs/models/operations/refreshlibraryresponse.md +++ b/docs/models/operations/getrefreshlibrarymetadataresponse.md @@ -1,4 +1,4 @@ -# RefreshLibraryResponse +# GetRefreshLibraryMetadataResponse ## Fields diff --git a/docs/models/operations/getsearchlibrarymediacontainer.md b/docs/models/operations/getsearchlibrarymediacontainer.md new file mode 100644 index 0000000..bfa6115 --- /dev/null +++ b/docs/models/operations/getsearchlibrarymediacontainer.md @@ -0,0 +1,20 @@ +# GetSearchLibraryMediaContainer + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Size` | **int* | :heavy_minus_sign: | N/A | 2 | +| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | false | +| `Art` | **string* | :heavy_minus_sign: | N/A | /:/resources/show-fanart.jpg | +| `Identifier` | **string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library | +| `MediaTagPrefix` | **string* | :heavy_minus_sign: | N/A | /system/bundle/media/flags/ | +| `MediaTagVersion` | **int* | :heavy_minus_sign: | N/A | 1698860922 | +| `Nocache` | **bool* | :heavy_minus_sign: | N/A | true | +| `Thumb` | **string* | :heavy_minus_sign: | N/A | /:/resources/show.png | +| `Title1` | **string* | :heavy_minus_sign: | N/A | TV Shows | +| `Title2` | **string* | :heavy_minus_sign: | N/A | Search for '' | +| `ViewGroup` | **string* | :heavy_minus_sign: | N/A | season | +| `ViewMode` | **int* | :heavy_minus_sign: | N/A | 65593 | +| `Metadata` | [][operations.GetSearchLibraryMetadata](../../models/operations/getsearchlibrarymetadata.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/searchlibrarymetadata.md b/docs/models/operations/getsearchlibrarymetadata.md similarity index 99% rename from docs/models/operations/searchlibrarymetadata.md rename to docs/models/operations/getsearchlibrarymetadata.md index e1c809b..0d3c187 100644 --- a/docs/models/operations/searchlibrarymetadata.md +++ b/docs/models/operations/getsearchlibrarymetadata.md @@ -1,4 +1,4 @@ -# SearchLibraryMetadata +# GetSearchLibraryMetadata ## Fields diff --git a/docs/models/operations/getsearchlibraryrequest.md b/docs/models/operations/getsearchlibraryrequest.md new file mode 100644 index 0000000..57dbda2 --- /dev/null +++ b/docs/models/operations/getsearchlibraryrequest.md @@ -0,0 +1,9 @@ +# GetSearchLibraryRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | +| `Type` | [operations.QueryParamType](../../models/operations/queryparamtype.md) | :heavy_check_mark: | The type of media to retrieve.
1 = movie
2 = show
3 = season
4 = episode
E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
| 2 | \ No newline at end of file diff --git a/docs/models/operations/getsearchlibraryresponse.md b/docs/models/operations/getsearchlibraryresponse.md new file mode 100644 index 0000000..991030e --- /dev/null +++ b/docs/models/operations/getsearchlibraryresponse.md @@ -0,0 +1,11 @@ +# GetSearchLibraryResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Object` | [*operations.GetSearchLibraryResponseBody](../../models/operations/getsearchlibraryresponsebody.md) | :heavy_minus_sign: | The contents of the library by section and type | \ No newline at end of file diff --git a/docs/models/operations/getsearchlibraryresponsebody.md b/docs/models/operations/getsearchlibraryresponsebody.md new file mode 100644 index 0000000..1093c8a --- /dev/null +++ b/docs/models/operations/getsearchlibraryresponsebody.md @@ -0,0 +1,10 @@ +# GetSearchLibraryResponseBody + +The contents of the library by section and type + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | +| `MediaContainer` | [*operations.GetSearchLibraryMediaContainer](../../models/operations/getsearchlibrarymediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/getserverresourcesglobals.md b/docs/models/operations/getserverresourcesglobals.md new file mode 100644 index 0000000..4a8b4dd --- /dev/null +++ b/docs/models/operations/getserverresourcesglobals.md @@ -0,0 +1,8 @@ +# GetServerResourcesGlobals + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | \ No newline at end of file diff --git a/docs/models/operations/getserverresourcesrequest.md b/docs/models/operations/getserverresourcesrequest.md new file mode 100644 index 0000000..7861190 --- /dev/null +++ b/docs/models/operations/getserverresourcesrequest.md @@ -0,0 +1,12 @@ +# GetServerResourcesRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | +| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | +| `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 | \ No newline at end of file diff --git a/docs/models/operations/getserverresourcesresponse.md b/docs/models/operations/getserverresourcesresponse.md new file mode 100644 index 0000000..5c6e8fb --- /dev/null +++ b/docs/models/operations/getserverresourcesresponse.md @@ -0,0 +1,11 @@ +# GetServerResourcesResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `PlexDevices` | [][operations.PlexDevice](../../models/operations/plexdevice.md) | :heavy_minus_sign: | List of Plex Devices. This includes Plex hosted servers and clients | \ No newline at end of file diff --git a/docs/models/operations/getsessionhistoryrequest.md b/docs/models/operations/getsessionhistoryrequest.md index ee76742..83566f4 100644 --- a/docs/models/operations/getsessionhistoryrequest.md +++ b/docs/models/operations/getsessionhistoryrequest.md @@ -7,5 +7,5 @@ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Sort` | **string* | :heavy_minus_sign: | Sorts the results by the specified field followed by the direction (asc, desc)
| | | `AccountID` | **int64* | :heavy_minus_sign: | Filter results by those that are related to a specific users id
| 1 | -| `Filter` | [*operations.Filter](../../models/operations/filter.md) | :heavy_minus_sign: | Filters content by field and direction/equality
(Unknown if viewedAt is the only supported column)
| {
"viewed-at-greater-than": {
"value": "viewedAt\u003e"
},
"viewed-at-greater-than-or-equal-to": {
"value": "viewedAt\u003e=\u003e"
},
"viewed-at-less-than": {
"value": "viewedAt\u003c"
}
} | +| `Filter` | [*operations.QueryParamFilter](../../models/operations/queryparamfilter.md) | :heavy_minus_sign: | Filters content by field and direction/equality
(Unknown if viewedAt is the only supported column)
| {
"viewed-at-greater-than": {
"value": "viewedAt\u003e"
},
"viewed-at-greater-than-or-equal-to": {
"value": "viewedAt\u003e=\u003e"
},
"viewed-at-less-than": {
"value": "viewedAt\u003c"
}
} | | `LibrarySectionID` | **int64* | :heavy_minus_sign: | Filters the results based on the id of a valid library section
| 12 | \ No newline at end of file diff --git a/docs/models/operations/getthumbimagerequest.md b/docs/models/operations/getthumbimagerequest.md new file mode 100644 index 0000000..1952462 --- /dev/null +++ b/docs/models/operations/getthumbimagerequest.md @@ -0,0 +1,13 @@ +# GetThumbImageRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| `RatingKey` | *int64* | :heavy_check_mark: | the id of the library item to return the children of. | 9518 | +| `Width` | *int64* | :heavy_check_mark: | N/A | 396 | +| `Height` | *int64* | :heavy_check_mark: | N/A | 396 | +| `MinSize` | *int64* | :heavy_check_mark: | N/A | 1 | +| `Upscale` | *int64* | :heavy_check_mark: | N/A | 1 | +| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file diff --git a/docs/models/operations/getthumbimageresponse.md b/docs/models/operations/getthumbimageresponse.md new file mode 100644 index 0000000..00eac04 --- /dev/null +++ b/docs/models/operations/getthumbimageresponse.md @@ -0,0 +1,12 @@ +# GetThumbImageResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `ResponseStream` | *io.ReadCloser* | :heavy_minus_sign: | Successful response returning an image | +| `Headers` | map[string][]*string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/gettokenbypinidauthpincontainer.md b/docs/models/operations/gettokenbypinidauthpincontainer.md new file mode 100644 index 0000000..5f7cfde --- /dev/null +++ b/docs/models/operations/gettokenbypinidauthpincontainer.md @@ -0,0 +1,21 @@ +# GetTokenByPinIDAuthPinContainer + +The Pin with a non-null authToken when it has been verified by the user + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ID` | *int64* | :heavy_check_mark: | N/A | 308667304 | +| `Code` | *string* | :heavy_check_mark: | N/A | 7RQZ | +| `Product` | *string* | :heavy_check_mark: | N/A | 0 | +| `Trusted` | **bool* | :heavy_minus_sign: | N/A | | +| `Qr` | *string* | :heavy_check_mark: | N/A | https://plex.tv/api/v2/pins/qr/7RQZ | +| `ClientIdentifier` | *string* | :heavy_check_mark: | The X-Client-Identifier used in the request | | +| `Location` | [operations.GetTokenByPinIDGeoData](../../models/operations/gettokenbypinidgeodata.md) | :heavy_check_mark: | Geo location data | {
"code": "VI",
"continent_code": "NA",
"country": "United States Virgin Islands",
"city": "Amsterdam",
"european_union_member": true,
"time_zone": "America/St_Thomas",
"postal_code": 802,
"in_privacy_restricted_country": true,
"in_privacy_restricted_region": true,
"subdivisions": "Saint Thomas",
"coordinates": "18.3381, -64.8941"
} | +| `ExpiresIn` | **int64* | :heavy_minus_sign: | The number of seconds this pin expires, by default 900 seconds | 876 | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | 2024-07-16T17:03:05Z | +| `ExpiresAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | 2024-07-16T17:18:05Z | +| `AuthToken` | *any* | :heavy_minus_sign: | N/A | | +| `NewRegistration` | *any* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/gettokenbypinidgeodata.md b/docs/models/operations/gettokenbypinidgeodata.md new file mode 100644 index 0000000..29fade7 --- /dev/null +++ b/docs/models/operations/gettokenbypinidgeodata.md @@ -0,0 +1,20 @@ +# GetTokenByPinIDGeoData + +Geo location data + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `Code` | *string* | :heavy_check_mark: | The ISO 3166-1 alpha-2 code of the country. | VI | +| `ContinentCode` | *string* | :heavy_check_mark: | The continent code where the country is located. | NA | +| `Country` | *string* | :heavy_check_mark: | The official name of the country. | United States Virgin Islands | +| `City` | *string* | :heavy_check_mark: | The name of the city. | Amsterdam | +| `EuropeanUnionMember` | **bool* | :heavy_minus_sign: | Indicates if the country is a member of the European Union. | true | +| `TimeZone` | *string* | :heavy_check_mark: | The time zone of the country. | America/St_Thomas | +| `PostalCode` | *int64* | :heavy_check_mark: | The postal code of the location. | 802 | +| `InPrivacyRestrictedCountry` | **bool* | :heavy_minus_sign: | Indicates if the country has privacy restrictions. | true | +| `InPrivacyRestrictedRegion` | **bool* | :heavy_minus_sign: | Indicates if the region has privacy restrictions. | true | +| `Subdivisions` | *string* | :heavy_check_mark: | The name of the primary administrative subdivision. | Saint Thomas | +| `Coordinates` | *string* | :heavy_check_mark: | The geographical coordinates (latitude, longitude) of the location. | 18.3381, -64.8941 | \ No newline at end of file diff --git a/docs/models/operations/gettokenglobals.md b/docs/models/operations/gettokenbypinidglobals.md similarity index 94% rename from docs/models/operations/gettokenglobals.md rename to docs/models/operations/gettokenbypinidglobals.md index 367b5ed..9a700ff 100644 --- a/docs/models/operations/gettokenglobals.md +++ b/docs/models/operations/gettokenbypinidglobals.md @@ -1,8 +1,8 @@ -# GetTokenGlobals +# GetTokenByPinIDGlobals ## Fields | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | \ No newline at end of file +| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | \ No newline at end of file diff --git a/docs/models/operations/gettokenrequest.md b/docs/models/operations/gettokenbypinidrequest.md similarity index 92% rename from docs/models/operations/gettokenrequest.md rename to docs/models/operations/gettokenbypinidrequest.md index 50e3683..ebc355c 100644 --- a/docs/models/operations/gettokenrequest.md +++ b/docs/models/operations/gettokenbypinidrequest.md @@ -1,9 +1,9 @@ -# GetTokenRequest +# GetTokenByPinIDRequest ## Fields | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `PinID` | *string* | :heavy_check_mark: | The PinID to retrieve an access token for | | -| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | \ No newline at end of file +| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | +| `PinID` | *int64* | :heavy_check_mark: | The PinID to retrieve an access token for | | \ No newline at end of file diff --git a/docs/models/operations/gettokenbypinidresponse.md b/docs/models/operations/gettokenbypinidresponse.md new file mode 100644 index 0000000..ec75b46 --- /dev/null +++ b/docs/models/operations/gettokenbypinidresponse.md @@ -0,0 +1,11 @@ +# GetTokenByPinIDResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `AuthPinContainer` | [*operations.GetTokenByPinIDAuthPinContainer](../../models/operations/gettokenbypinidauthpincontainer.md) | :heavy_minus_sign: | The Pin with a non-null authToken when it has been verified by the user | {
"id": 308667304,
"code": "7RQZ",
"product": "0",
"trusted": false,
"qr": "https://plex.tv/api/v2/pins/qr/7RQZ",
"clientIdentifier": "string",
"location": {
"code": "VI",
"continent_code": "NA",
"country": "United States Virgin Islands",
"city": "Amsterdam",
"european_union_member": true,
"time_zone": "America/St_Thomas",
"postal_code": 802,
"in_privacy_restricted_country": true,
"in_privacy_restricted_region": true,
"subdivisions": "Saint Thomas",
"coordinates": "18.3381, -64.8941"
},
"expiresIn": 876,
"createdAt": "2024-07-16T17:03:05Z",
"expiresAt": "2024-07-16T17:18:05Z",
"authToken": null,
"newRegistration": null
} | \ No newline at end of file diff --git a/docs/models/operations/gettokenlocation.md b/docs/models/operations/gettokenlocation.md deleted file mode 100644 index 2b86a2f..0000000 --- a/docs/models/operations/gettokenlocation.md +++ /dev/null @@ -1,17 +0,0 @@ -# GetTokenLocation - - -## Fields - -| Field | Type | Required | Description | Example | -| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | -| `Code` | **string* | :heavy_minus_sign: | N/A | US | -| `EuropeanUnionMember` | **bool* | :heavy_minus_sign: | N/A | | -| `ContinentCode` | **string* | :heavy_minus_sign: | N/A | NA | -| `Country` | **string* | :heavy_minus_sign: | N/A | United States | -| `City` | **string* | :heavy_minus_sign: | N/A | Austin | -| `TimeZone` | **string* | :heavy_minus_sign: | N/A | America/Chicago | -| `PostalCode` | **string* | :heavy_minus_sign: | N/A | 78732 | -| `InPrivacyRestrictedCountry` | **bool* | :heavy_minus_sign: | N/A | | -| `Subdivisions` | **string* | :heavy_minus_sign: | N/A | Texas | -| `Coordinates` | **string* | :heavy_minus_sign: | N/A | 30.3768 -97.8935 | \ No newline at end of file diff --git a/docs/models/operations/gettokenresponse.md b/docs/models/operations/gettokenresponse.md deleted file mode 100644 index e60f2c5..0000000 --- a/docs/models/operations/gettokenresponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetTokenResponse - - -## Fields - -| Field | Type | Required | Description | -| ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `Object` | [*operations.GetTokenResponseBody](../../models/operations/gettokenresponsebody.md) | :heavy_minus_sign: | Access Token | \ No newline at end of file diff --git a/docs/models/operations/gettokenresponsebody.md b/docs/models/operations/gettokenresponsebody.md deleted file mode 100644 index e415604..0000000 --- a/docs/models/operations/gettokenresponsebody.md +++ /dev/null @@ -1,21 +0,0 @@ -# GetTokenResponseBody - -Access Token - - -## Fields - -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ID` | **float64* | :heavy_minus_sign: | PinID for use with authentication | 1272322473 | -| `Code` | **string* | :heavy_minus_sign: | N/A | 3patfx1a78ukcbr7x0n9bl26t | -| `Product` | **string* | :heavy_minus_sign: | N/A | Plex Web | -| `Trusted` | **bool* | :heavy_minus_sign: | N/A | | -| `Qr` | **string* | :heavy_minus_sign: | a link to a QR code hosted on plex.tv
The QR code redirects to the relevant `plex.tv/link` authentication page
Which then prompts the user for the 4 Digit Link Pin
| https://plex.tv/api/v2/pins/qr/3patfx1a78ukcbr7x0n9bl26t | -| `ClientIdentifier` | **string* | :heavy_minus_sign: | N/A | Postman | -| `Location` | [*operations.GetTokenLocation](../../models/operations/gettokenlocation.md) | :heavy_minus_sign: | N/A | | -| `ExpiresIn` | **float64* | :heavy_minus_sign: | N/A | 1800 | -| `CreatedAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | N/A | 2023-04-12 17:00:03 +0000 UTC | -| `ExpiresAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | N/A | 2023-04-12 17:30:03 +0000 UTC | -| `AuthToken` | **string* | :heavy_minus_sign: | N/A | | -| `NewRegistration` | **string* | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentqueryparamtype.md b/docs/models/operations/gettopwatchedcontentqueryparamtype.md new file mode 100644 index 0000000..1300323 --- /dev/null +++ b/docs/models/operations/gettopwatchedcontentqueryparamtype.md @@ -0,0 +1,19 @@ +# GetTopWatchedContentQueryParamType + +The type of media to retrieve. +1 = movie +2 = show +3 = season +4 = episode +E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries + + + +## Values + +| Name | Value | +| ----------------------------------------- | ----------------------------------------- | +| `GetTopWatchedContentQueryParamTypeOne` | 1 | +| `GetTopWatchedContentQueryParamTypeTwo` | 2 | +| `GetTopWatchedContentQueryParamTypeThree` | 3 | +| `GetTopWatchedContentQueryParamTypeFour` | 4 | \ No newline at end of file diff --git a/docs/models/operations/gettopwatchedcontentrequest.md b/docs/models/operations/gettopwatchedcontentrequest.md index 60b0593..3bd0c2b 100644 --- a/docs/models/operations/gettopwatchedcontentrequest.md +++ b/docs/models/operations/gettopwatchedcontentrequest.md @@ -3,7 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | -| `Type` | *int64* | :heavy_check_mark: | the library type (1 - movies, 2 - shows, 3 - music) | | -| `IncludeGuids` | **int64* | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Type` | [operations.GetTopWatchedContentQueryParamType](../../models/operations/gettopwatchedcontentqueryparamtype.md) | :heavy_check_mark: | The type of media to retrieve.
1 = movie
2 = show
3 = season
4 = episode
E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
| 2 | +| `IncludeGuids` | **int64* | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | \ No newline at end of file diff --git a/docs/models/operations/getuserdetailsauthenticationresponsestatus.md b/docs/models/operations/getuserdetailsauthenticationresponsestatus.md new file mode 100644 index 0000000..196207e --- /dev/null +++ b/docs/models/operations/getuserdetailsauthenticationresponsestatus.md @@ -0,0 +1,11 @@ +# GetUserDetailsAuthenticationResponseStatus + +String representation of subscriptionActive + + +## Values + +| Name | Value | +| ---------------------------------------------------- | ---------------------------------------------------- | +| `GetUserDetailsAuthenticationResponseStatusInactive` | Inactive | +| `GetUserDetailsAuthenticationResponseStatusActive` | Active | \ No newline at end of file diff --git a/docs/models/operations/getuserdetailsauthenticationstatus.md b/docs/models/operations/getuserdetailsauthenticationstatus.md new file mode 100644 index 0000000..d940088 --- /dev/null +++ b/docs/models/operations/getuserdetailsauthenticationstatus.md @@ -0,0 +1,11 @@ +# GetUserDetailsAuthenticationStatus + +String representation of subscriptionActive + + +## Values + +| Name | Value | +| -------------------------------------------- | -------------------------------------------- | +| `GetUserDetailsAuthenticationStatusInactive` | Inactive | +| `GetUserDetailsAuthenticationStatusActive` | Active | \ No newline at end of file diff --git a/docs/models/operations/getuserdetailsfeatures.md b/docs/models/operations/getuserdetailsfeatures.md new file mode 100644 index 0000000..507c496 --- /dev/null +++ b/docs/models/operations/getuserdetailsfeatures.md @@ -0,0 +1,66 @@ +# GetUserDetailsFeatures + + +## Values + +| Name | Value | +| ----------------------------------------------------------- | ----------------------------------------------------------- | +| `GetUserDetailsFeaturesAndroidDolbyVision` | Android - Dolby Vision | +| `GetUserDetailsFeaturesAndroidPiP` | Android - PiP | +| `GetUserDetailsFeaturesCuSunset` | CU Sunset | +| `GetUserDetailsFeaturesHrkEnableEur` | HRK_enable_EUR | +| `GetUserDetailsFeaturesTrebleShowFeatures` | TREBLE-show-features | +| `GetUserDetailsFeaturesAdCountdownTimer` | ad-countdown-timer | +| `GetUserDetailsFeaturesAdaptiveBitrate` | adaptive_bitrate | +| `GetUserDetailsFeaturesAmazonLoopDebug` | amazon-loop-debug | +| `GetUserDetailsFeaturesAvodAdAnalysis` | avod-ad-analysis | +| `GetUserDetailsFeaturesAvodNewMedia` | avod-new-media | +| `GetUserDetailsFeaturesBlacklistGetSignin` | blacklist_get_signin | +| `GetUserDetailsFeaturesClientRadioStations` | client-radio-stations | +| `GetUserDetailsFeaturesCloudflareTurnstileRequired` | cloudflare-turnstile-required | +| `GetUserDetailsFeaturesCollections` | collections | +| `GetUserDetailsFeaturesCommentsAndRepliesPushNotifications` | comments_and_replies_push_notifications | +| `GetUserDetailsFeaturesCommunityAccessPlexTv` | community_access_plex_tv | +| `GetUserDetailsFeaturesCompanionsSonos` | companions_sonos | +| `GetUserDetailsFeaturesCustomHomeRemoval` | custom-home-removal | +| `GetUserDetailsFeaturesDisableHomeUserFriendships` | disable_home_user_friendships | +| `GetUserDetailsFeaturesDisableSharingFriendships` | disable_sharing_friendships | +| `GetUserDetailsFeaturesDrmSupport` | drm_support | +| `GetUserDetailsFeaturesExcludeRestrictions` | exclude restrictions | +| `GetUserDetailsFeaturesFederatedAuth` | federated-auth | +| `GetUserDetailsFeaturesFriendRequestPushNotifications` | friend_request_push_notifications | +| `GetUserDetailsFeaturesGuidedUpgrade` | guided-upgrade | +| `GetUserDetailsFeaturesHome` | home | +| `GetUserDetailsFeaturesIncreasePasswordComplexity` | increase-password-complexity | +| `GetUserDetailsFeaturesIos14PrivacyBanner` | ios14-privacy-banner | +| `GetUserDetailsFeaturesIterableNotificationTokens` | iterable-notification-tokens | +| `GetUserDetailsFeaturesKeepPaymentMethod` | keep-payment-method | +| `GetUserDetailsFeaturesKevinBacon` | kevin-bacon | +| `GetUserDetailsFeaturesKoreaConsent` | korea-consent | +| `GetUserDetailsFeaturesLeIsrgRootX1` | le_isrg_root_x1 | +| `GetUserDetailsFeaturesLetsEncrypt` | lets_encrypt | +| `GetUserDetailsFeaturesLightningDvrPivot` | lightning-dvr-pivot | +| `GetUserDetailsFeaturesLiveTvSupportIncompleteSegments` | live-tv-support-incomplete-segments | +| `GetUserDetailsFeaturesLivetv` | livetv | +| `GetUserDetailsFeaturesMetadataSearch` | metadata_search | +| `GetUserDetailsFeaturesNewPlexPassPrices` | new_plex_pass_prices | +| `GetUserDetailsFeaturesNewsProviderSunsetModal` | news-provider-sunset-modal | +| `GetUserDetailsFeaturesPhotosFavorites` | photos-favorites | +| `GetUserDetailsFeaturesPhotosMetadataEdition` | photos-metadata-edition | +| `GetUserDetailsFeaturesPmsHealth` | pms_health | +| `GetUserDetailsFeaturesRadio` | radio | +| `GetUserDetailsFeaturesRateLimitClientToken` | rate-limit-client-token | +| `GetUserDetailsFeaturesScrobblingServicePlexTv` | scrobbling-service-plex-tv | +| `GetUserDetailsFeaturesSharedServerNotification` | shared_server_notification | +| `GetUserDetailsFeaturesSharedSourceNotification` | shared_source_notification | +| `GetUserDetailsFeaturesSigninWithApple` | signin_with_apple | +| `GetUserDetailsFeaturesSpringServeAdProvider` | spring_serve_ad_provider | +| `GetUserDetailsFeaturesTranscoderCache` | transcoder_cache | +| `GetUserDetailsFeaturesTunerSharing` | tuner-sharing | +| `GetUserDetailsFeaturesTwoFactorAuthentication` | two-factor-authentication | +| `GetUserDetailsFeaturesUnsupportedtuners` | unsupportedtuners | +| `GetUserDetailsFeaturesUpgrade3ds2` | upgrade-3ds2 | +| `GetUserDetailsFeaturesVodSchema` | vod-schema | +| `GetUserDetailsFeaturesVodCloudflare` | vod_cloudflare | +| `GetUserDetailsFeaturesWatchTogetherInvite` | watch-together-invite | +| `GetUserDetailsFeaturesWebServerDashboard` | web_server_dashboard | \ No newline at end of file diff --git a/docs/models/operations/getuserdetailsrequest.md b/docs/models/operations/getuserdetailsrequest.md new file mode 100644 index 0000000..6ab3cdd --- /dev/null +++ b/docs/models/operations/getuserdetailsrequest.md @@ -0,0 +1,8 @@ +# GetUserDetailsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------- | ------------------------- | ------------------------- | ------------------------- | ------------------------- | +| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file diff --git a/docs/models/operations/getuserdetailsresponse.md b/docs/models/operations/getuserdetailsresponse.md new file mode 100644 index 0000000..8781730 --- /dev/null +++ b/docs/models/operations/getuserdetailsresponse.md @@ -0,0 +1,11 @@ +# GetUserDetailsResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `UserPlexAccount` | [*operations.GetUserDetailsUserPlexAccount](../../models/operations/getuserdetailsuserplexaccount.md) | :heavy_minus_sign: | Logged in user details | {
"adsConsent": true,
"adsConsentReminderAt": "2019-08-24T14:15:22Z",
"adsConsentSetAt": "2019-08-24T14:15:22Z",
"anonymous": false,
"authToken": "CxoUzBTSV5hsxjTpFKaf",
"backupCodesCreated": false,
"confirmed": false,
"country": "US",
"email": "username@email.com",
"emailOnlyAuth": false,
"experimentalFeatures": false,
"friendlyName": "friendlyUsername",
"entitlements": [],
"guest": false,
"hasPassword": true,
"home": false,
"homeAdmin": false,
"homeSize": 1,
"id": 13692262,
"joinedAt": 1721154902,
"locale": null,
"mailingListActive": false,
"mailingListStatus": "subscribed",
"maxHomeSize": 15,
"pastSubscriptions": [
{
"id": "string",
"mode": "string",
"renewsAt": "string",
"endsAt": "1556281940",
"canceled": "0",
"gracePeriod": "0",
"onHold": "0",
"canReactivate": "0",
"canUpgrade": "0",
"canDowngrade": "0",
"canConvert": "0",
"type": "plexpass",
"transfer": "string",
"state": "ended",
"billing": [
{
"internalPaymentMethod": "string",
"paymentMethodId": "string"
}
]
}
],
"pin": "string",
"profile": [
{
"autoSelectAudio": true,
"defaultAudioLanguage": "ja",
"defaultSubtitleLanguage": "en",
"autoSelectSubtitle": 1,
"defaultSubtitleAccessibility": 1,
"defaultSubtitleForced": 0,
"watchedIndicator": 1,
"mediaReviewsVisibility": 0
}
],
"protected": false,
"rememberExpiresAt": 1722364046,
"restricted": false,
"roles": [
"string"
],
"scrobbleTypes": "",
"services": [
{
"identifier": "metadata-dev",
"endpoint": "https://epg.provider.plex.tv",
"token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv",
"secret": "string",
"status": "online"
}
],
"subscription": {
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
},
"subscriptionDescription": "string",
"subscriptions": [
{
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
}
],
"thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101",
"title": "UsernameTitle",
"trials": [
{}
],
"twoFactorEnabled": false,
"username": "Username",
"uuid": "dae343c1f45beb4f"
} | \ No newline at end of file diff --git a/docs/models/operations/getuserdetailsstatus.md b/docs/models/operations/getuserdetailsstatus.md new file mode 100644 index 0000000..c1d3430 --- /dev/null +++ b/docs/models/operations/getuserdetailsstatus.md @@ -0,0 +1,9 @@ +# GetUserDetailsStatus + + +## Values + +| Name | Value | +| ----------------------------- | ----------------------------- | +| `GetUserDetailsStatusOnline` | online | +| `GetUserDetailsStatusOffline` | offline | \ No newline at end of file diff --git a/docs/models/operations/getuserdetailssubscription.md b/docs/models/operations/getuserdetailssubscription.md new file mode 100644 index 0000000..f155f6f --- /dev/null +++ b/docs/models/operations/getuserdetailssubscription.md @@ -0,0 +1,13 @@ +# GetUserDetailsSubscription + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | +| `Features` | [][operations.GetUserDetailsFeatures](../../models/operations/getuserdetailsfeatures.md) | :heavy_minus_sign: | List of features allowed on your Plex Pass subscription | | +| `Active` | **bool* | :heavy_minus_sign: | If the account's Plex Pass subscription is active | true | +| `SubscribedAt` | **string* | :heavy_minus_sign: | Date the account subscribed to Plex Pass | 2021-04-12T18:21:12Z | +| `Status` | [*operations.GetUserDetailsAuthenticationResponseStatus](../../models/operations/getuserdetailsauthenticationresponsestatus.md) | :heavy_minus_sign: | String representation of subscriptionActive | Inactive | +| `PaymentService` | **string* | :heavy_minus_sign: | Payment service used for your Plex Pass subscription | | +| `Plan` | **string* | :heavy_minus_sign: | Name of Plex Pass subscription plan | | \ No newline at end of file diff --git a/docs/models/operations/getuserdetailsuserplexaccount.md b/docs/models/operations/getuserdetailsuserplexaccount.md new file mode 100644 index 0000000..b9f00d7 --- /dev/null +++ b/docs/models/operations/getuserdetailsuserplexaccount.md @@ -0,0 +1,49 @@ +# GetUserDetailsUserPlexAccount + +Logged in user details + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AdsConsent` | *bool* | :heavy_check_mark: | Unknown | | +| `AdsConsentReminderAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Unknown | | +| `AdsConsentSetAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Unknown | | +| `Anonymous` | **bool* | :heavy_minus_sign: | Unknown | | +| `AuthToken` | *string* | :heavy_check_mark: | The account token | CxoUzBTSV5hsxjTpFKaf | +| `BackupCodesCreated` | **bool* | :heavy_minus_sign: | If the two-factor authentication backup codes have been created | | +| `Confirmed` | **bool* | :heavy_minus_sign: | If the account has been confirmed | | +| `Country` | *string* | :heavy_check_mark: | The account country | US | +| `Email` | *string* | :heavy_check_mark: | The account email address | username@email.com | +| `EmailOnlyAuth` | **bool* | :heavy_minus_sign: | If login with email only is enabled | | +| `ExperimentalFeatures` | **bool* | :heavy_minus_sign: | If experimental features are enabled | | +| `FriendlyName` | *string* | :heavy_check_mark: | Your account full name | friendlyUsername | +| `Entitlements` | []*string* | :heavy_check_mark: | List of devices your allowed to use with this account | | +| `Guest` | **bool* | :heavy_minus_sign: | If the account is a Plex Home guest user | | +| `HasPassword` | **bool* | :heavy_minus_sign: | If the account has a password | | +| `Home` | **bool* | :heavy_minus_sign: | If the account is a Plex Home user | | +| `HomeAdmin` | **bool* | :heavy_minus_sign: | If the account is the Plex Home admin | | +| `HomeSize` | *int* | :heavy_check_mark: | The number of accounts in the Plex Home | 1 | +| `ID` | *int* | :heavy_check_mark: | The Plex account ID | 13692262 | +| `JoinedAt` | *int64* | :heavy_check_mark: | Unix epoch datetime | 1556281940 | +| `Locale` | *string* | :heavy_check_mark: | The account locale | | +| `MailingListActive` | **bool* | :heavy_minus_sign: | If you are subscribed to the Plex newsletter | | +| `MailingListStatus` | [operations.MailingListStatus](../../models/operations/mailingliststatus.md) | :heavy_check_mark: | Your current mailing list status | | +| `MaxHomeSize` | *int* | :heavy_check_mark: | The maximum number of accounts allowed in the Plex Home | 15 | +| ~~`Pin`~~ | **string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

[Might be removed] The hashed Plex Home PIN | | +| `Profile` | [operations.UserProfile](../../models/operations/userprofile.md) | :heavy_check_mark: | N/A | | +| `Protected` | **bool* | :heavy_minus_sign: | If the account has a Plex Home PIN enabled | | +| `RememberExpiresAt` | *int64* | :heavy_check_mark: | Unix epoch datetime | 1556281940 | +| `Restricted` | **bool* | :heavy_minus_sign: | If the account is a Plex Home managed user | | +| `Roles` | []*string* | :heavy_minus_sign: | [Might be removed] List of account roles. Plexpass membership listed here | | +| `ScrobbleTypes` | *string* | :heavy_check_mark: | Unknown | | +| `Services` | [][operations.Services](../../models/operations/services.md) | :heavy_check_mark: | N/A | | +| `Subscription` | [operations.Subscription](../../models/operations/subscription.md) | :heavy_check_mark: | If the account’s Plex Pass subscription is active | | +| `SubscriptionDescription` | *string* | :heavy_check_mark: | Description of the Plex Pass subscription | | +| `Subscriptions` | [][operations.GetUserDetailsSubscription](../../models/operations/getuserdetailssubscription.md) | :heavy_check_mark: | N/A | | +| `Thumb` | *string* | :heavy_check_mark: | URL of the account thumbnail | https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101 | +| `Title` | *string* | :heavy_check_mark: | The title of the account (username or friendly name) | UsernameTitle | +| `TwoFactorEnabled` | **bool* | :heavy_minus_sign: | If two-factor authentication is enabled | | +| `Username` | *string* | :heavy_check_mark: | The account username | Username | +| `UUID` | *string* | :heavy_check_mark: | The account UUID | dae343c1f45beb4f | \ No newline at end of file diff --git a/docs/models/operations/getuserfriendsresponse.md b/docs/models/operations/getuserfriendsresponse.md new file mode 100644 index 0000000..9f4ecd9 --- /dev/null +++ b/docs/models/operations/getuserfriendsresponse.md @@ -0,0 +1,11 @@ +# GetUserFriendsResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `Friends` | [][operations.Friend](../../models/operations/friend.md) | :heavy_minus_sign: | Friends Data | \ No newline at end of file diff --git a/docs/models/operations/getwatchlistrequest.md b/docs/models/operations/getwatchlistrequest.md index 1d04e4e..237870f 100644 --- a/docs/models/operations/getwatchlistrequest.md +++ b/docs/models/operations/getwatchlistrequest.md @@ -1,16 +1,16 @@ -# GetWatchlistRequest +# GetWatchListRequest ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Filter` | [operations.PathParamFilter](../../models/operations/pathparamfilter.md) | :heavy_check_mark: | Filter | -| `Sort` | **string* | :heavy_minus_sign: | In the format "field:dir". Available fields are "watchlistedAt" (Added At),
"titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating).
"dir" can be "asc" or "desc"
| -| `Libtype` | [*operations.Libtype](../../models/operations/libtype.md) | :heavy_minus_sign: | The type of library to filter. Can be "movie" or "show", or all if not present.
| -| `Maxresults` | **int* | :heavy_minus_sign: | The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
| -| `IncludeCollections` | [*operations.IncludeCollections](../../models/operations/includecollections.md) | :heavy_minus_sign: | include collections in the results
| -| `IncludeExternalMedia` | [*operations.IncludeExternalMedia](../../models/operations/includeexternalmedia.md) | :heavy_minus_sign: | include external media in the results
| -| `XPlexToken` | *string* | :heavy_check_mark: | User Token | -| `XPlexContainerStart` | **int* | :heavy_minus_sign: | The index of the first item to return. If not specified, the first item will be returned.
If the number of items exceeds the limit, the response will be paginated.
| -| `XPlexContainerSize` | **int* | :heavy_minus_sign: | The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
| \ No newline at end of file +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Filter` | [operations.Filter](../../models/operations/filter.md) | :heavy_check_mark: | Filter | | +| `Sort` | **string* | :heavy_minus_sign: | In the format "field:dir". Available fields are "watchlistedAt" (Added At),
"titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating).
"dir" can be "asc" or "desc"
| | +| `Libtype` | [*operations.Libtype](../../models/operations/libtype.md) | :heavy_minus_sign: | The type of library to filter. Can be "movie" or "show", or all if not present.
| | +| `Maxresults` | **int* | :heavy_minus_sign: | The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
| | +| `IncludeCollections` | [*operations.IncludeCollections](../../models/operations/includecollections.md) | :heavy_minus_sign: | include collections in the results
| | +| `IncludeExternalMedia` | [*operations.IncludeExternalMedia](../../models/operations/includeexternalmedia.md) | :heavy_minus_sign: | include external media in the results
| | +| `XPlexContainerStart` | **int* | :heavy_minus_sign: | The index of the first item to return. If not specified, the first item will be returned.
If the number of items exceeds the limit, the response will be paginated.
By default this is 0
| 0 | +| `XPlexContainerSize` | **int* | :heavy_minus_sign: | The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
By default this is 50
| 50 | +| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file diff --git a/docs/models/operations/getwatchlistresponse.md b/docs/models/operations/getwatchlistresponse.md index a2cb253..4953e5a 100644 --- a/docs/models/operations/getwatchlistresponse.md +++ b/docs/models/operations/getwatchlistresponse.md @@ -1,4 +1,4 @@ -# GetWatchlistResponse +# GetWatchListResponse ## Fields @@ -8,4 +8,4 @@ | `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `Object` | [*operations.GetWatchlistResponseBody](../../models/operations/getwatchlistresponsebody.md) | :heavy_minus_sign: | Watchlist Data | \ No newline at end of file +| `Object` | [*operations.GetWatchListResponseBody](../../models/operations/getwatchlistresponsebody.md) | :heavy_minus_sign: | Watchlist Data | \ No newline at end of file diff --git a/docs/models/operations/getwatchlistresponsebody.md b/docs/models/operations/getwatchlistresponsebody.md index cc60bb8..1196c47 100644 --- a/docs/models/operations/getwatchlistresponsebody.md +++ b/docs/models/operations/getwatchlistresponsebody.md @@ -1,4 +1,4 @@ -# GetWatchlistResponseBody +# GetWatchListResponseBody Watchlist Data diff --git a/docs/models/operations/includeguids.md b/docs/models/operations/includeguids.md new file mode 100644 index 0000000..595767e --- /dev/null +++ b/docs/models/operations/includeguids.md @@ -0,0 +1,12 @@ +# IncludeGuids + +Adds the Guids object to the response + + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `IncludeGuidsZero` | 0 | +| `IncludeGuidsOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/includehttps.md b/docs/models/operations/includehttps.md new file mode 100644 index 0000000..8141d1e --- /dev/null +++ b/docs/models/operations/includehttps.md @@ -0,0 +1,11 @@ +# IncludeHTTPS + +Include Https entries in the results + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `IncludeHTTPSZero` | 0 | +| `IncludeHTTPSOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/includeipv6.md b/docs/models/operations/includeipv6.md new file mode 100644 index 0000000..77f8df2 --- /dev/null +++ b/docs/models/operations/includeipv6.md @@ -0,0 +1,11 @@ +# IncludeIPv6 + +Include IPv6 entries in the results + + +## Values + +| Name | Value | +| ----------------- | ----------------- | +| `IncludeIPv6Zero` | 0 | +| `IncludeIPv6One` | 1 | \ No newline at end of file diff --git a/docs/models/operations/includemeta.md b/docs/models/operations/includemeta.md new file mode 100644 index 0000000..4c5784e --- /dev/null +++ b/docs/models/operations/includemeta.md @@ -0,0 +1,12 @@ +# IncludeMeta + +Adds the Meta object to the response + + + +## Values + +| Name | Value | +| ----------------- | ----------------- | +| `IncludeMetaZero` | 0 | +| `IncludeMetaOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/includerelay.md b/docs/models/operations/includerelay.md new file mode 100644 index 0000000..03e52c2 --- /dev/null +++ b/docs/models/operations/includerelay.md @@ -0,0 +1,13 @@ +# IncludeRelay + +Include Relay addresses in the results +E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400 + + + +## Values + +| Name | Value | +| ------------------ | ------------------ | +| `IncludeRelayZero` | 0 | +| `IncludeRelayOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/internalpaymentmethod.md b/docs/models/operations/internalpaymentmethod.md new file mode 100644 index 0000000..f1103c2 --- /dev/null +++ b/docs/models/operations/internalpaymentmethod.md @@ -0,0 +1,7 @@ +# InternalPaymentMethod + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/location.md b/docs/models/operations/location.md index 01552da..62768c5 100644 --- a/docs/models/operations/location.md +++ b/docs/models/operations/location.md @@ -3,15 +3,7 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | ---------------------------- | -| `Code` | **string* | :heavy_minus_sign: | N/A | US | -| `EuropeanUnionMember` | **bool* | :heavy_minus_sign: | N/A | | -| `ContinentCode` | **string* | :heavy_minus_sign: | N/A | NA | -| `Country` | **string* | :heavy_minus_sign: | N/A | United States | -| `City` | **string* | :heavy_minus_sign: | N/A | Austin | -| `TimeZone` | **string* | :heavy_minus_sign: | N/A | America/Chicago | -| `PostalCode` | **string* | :heavy_minus_sign: | N/A | 78732 | -| `InPrivacyRestrictedCountry` | **bool* | :heavy_minus_sign: | N/A | | -| `Subdivisions` | **string* | :heavy_minus_sign: | N/A | Texas | -| `Coordinates` | **string* | :heavy_minus_sign: | N/A | 30.3768 -97.8935 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `ID` | **int* | :heavy_minus_sign: | N/A | 1 | +| `Path` | **string* | :heavy_minus_sign: | N/A | /movies | \ No newline at end of file diff --git a/docs/models/operations/mailingliststatus.md b/docs/models/operations/mailingliststatus.md new file mode 100644 index 0000000..4f2444a --- /dev/null +++ b/docs/models/operations/mailingliststatus.md @@ -0,0 +1,11 @@ +# MailingListStatus + +Your current mailing list status + + +## Values + +| Name | Value | +| ------------------------------- | ------------------------------- | +| `MailingListStatusActive` | active | +| `MailingListStatusUnsubscribed` | unsubscribed | \ No newline at end of file diff --git a/docs/models/operations/mediaprovider.md b/docs/models/operations/mediaprovider.md new file mode 100644 index 0000000..7cbe99e --- /dev/null +++ b/docs/models/operations/mediaprovider.md @@ -0,0 +1,12 @@ +# MediaProvider + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `Identifier` | **string* | :heavy_minus_sign: | N/A | +| `Title` | **string* | :heavy_minus_sign: | N/A | +| `Types` | **string* | :heavy_minus_sign: | N/A | +| `Protocols` | **string* | :heavy_minus_sign: | N/A | +| `Feature` | [][operations.Feature](../../models/operations/feature.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/mediareviewsvisibility.md b/docs/models/operations/mediareviewsvisibility.md new file mode 100644 index 0000000..146ea16 --- /dev/null +++ b/docs/models/operations/mediareviewsvisibility.md @@ -0,0 +1,9 @@ +# MediaReviewsVisibility + + +## Values + +| Name | Value | +| ---------------------------- | ---------------------------- | +| `MediaReviewsVisibilityZero` | 0 | +| `MediaReviewsVisibilityOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/option.md b/docs/models/operations/option.md index 9167702..35d8a1e 100644 --- a/docs/models/operations/option.md +++ b/docs/models/operations/option.md @@ -24,9 +24,9 @@ operations.WithTemplatedServerURL("http://{host}:{port}", map[string]string{ WithRetries allows customizing the default retry configuration. Only usable with methods that mention they support retries. ```go -operations.WithRetries(utils.RetryConfig{ +operations.WithRetries(retry.Config{ Strategy: "backoff", - Backoff: utils.BackoffStrategy{ + Backoff: retry.BackoffStrategy{ InitialInterval: 500 * time.Millisecond, MaxInterval: 60 * time.Second, Exponent: 1.5, diff --git a/docs/models/operations/pastsubscription.md b/docs/models/operations/pastsubscription.md new file mode 100644 index 0000000..32008a8 --- /dev/null +++ b/docs/models/operations/pastsubscription.md @@ -0,0 +1,22 @@ +# PastSubscription + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ID` | *string* | :heavy_check_mark: | N/A | | +| `Mode` | *string* | :heavy_check_mark: | N/A | | +| `RenewsAt` | *int64* | :heavy_check_mark: | N/A | 1556281940 | +| `EndsAt` | *int64* | :heavy_check_mark: | N/A | 1556281940 | +| `Canceled` | **bool* | :heavy_minus_sign: | N/A | false | +| `GracePeriod` | **bool* | :heavy_minus_sign: | N/A | false | +| `OnHold` | **bool* | :heavy_minus_sign: | N/A | false | +| `CanReactivate` | **bool* | :heavy_minus_sign: | N/A | false | +| `CanUpgrade` | **bool* | :heavy_minus_sign: | N/A | false | +| `CanDowngrade` | **bool* | :heavy_minus_sign: | N/A | false | +| `CanConvert` | **bool* | :heavy_minus_sign: | N/A | false | +| `Type` | *string* | :heavy_check_mark: | N/A | plexpass | +| `Transfer` | *string* | :heavy_check_mark: | N/A | | +| `State` | [operations.PostUsersSignInDataState](../../models/operations/postuserssignindatastate.md) | :heavy_check_mark: | N/A | ended | +| `Billing` | [operations.Billing](../../models/operations/billing.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/pathparamfilter.md b/docs/models/operations/pathparamfilter.md deleted file mode 100644 index ccef5f4..0000000 --- a/docs/models/operations/pathparamfilter.md +++ /dev/null @@ -1,12 +0,0 @@ -# PathParamFilter - -Filter - - -## Values - -| Name | Value | -| -------------------------- | -------------------------- | -| `PathParamFilterAll` | all | -| `PathParamFilterAvailable` | available | -| `PathParamFilterReleased` | released | \ No newline at end of file diff --git a/docs/models/operations/pivot.md b/docs/models/operations/pivot.md new file mode 100644 index 0000000..d3e3949 --- /dev/null +++ b/docs/models/operations/pivot.md @@ -0,0 +1,13 @@ +# Pivot + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `ID` | **string* | :heavy_minus_sign: | N/A | +| `Key` | **string* | :heavy_minus_sign: | N/A | +| `Type` | **string* | :heavy_minus_sign: | N/A | +| `Title` | **string* | :heavy_minus_sign: | N/A | +| `Context` | **string* | :heavy_minus_sign: | N/A | +| `Symbol` | **string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/plexdevice.md b/docs/models/operations/plexdevice.md new file mode 100644 index 0000000..0b30dc5 --- /dev/null +++ b/docs/models/operations/plexdevice.md @@ -0,0 +1,31 @@ +# PlexDevice + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `Name` | *string* | :heavy_check_mark: | N/A | +| `Product` | *string* | :heavy_check_mark: | N/A | +| `ProductVersion` | *string* | :heavy_check_mark: | N/A | +| `Platform` | *string* | :heavy_check_mark: | N/A | +| `PlatformVersion` | *string* | :heavy_check_mark: | N/A | +| `Device` | *string* | :heavy_check_mark: | N/A | +| `ClientIdentifier` | *string* | :heavy_check_mark: | N/A | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | +| `LastSeenAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | +| `Provides` | *string* | :heavy_check_mark: | N/A | +| `OwnerID` | *int64* | :heavy_check_mark: | ownerId is null when the device is owned by the token used to send the request | +| `SourceTitle` | *string* | :heavy_check_mark: | N/A | +| `PublicAddress` | *string* | :heavy_check_mark: | N/A | +| `AccessToken` | *string* | :heavy_check_mark: | N/A | +| `Owned` | *bool* | :heavy_check_mark: | N/A | +| `Home` | *bool* | :heavy_check_mark: | N/A | +| `Synced` | *bool* | :heavy_check_mark: | N/A | +| `Relay` | *bool* | :heavy_check_mark: | N/A | +| `Presence` | *bool* | :heavy_check_mark: | N/A | +| `HTTPSRequired` | *bool* | :heavy_check_mark: | N/A | +| `PublicAddressMatches` | *bool* | :heavy_check_mark: | N/A | +| `DNSRebindingProtection` | *bool* | :heavy_check_mark: | N/A | +| `NatLoopbackSupported` | *bool* | :heavy_check_mark: | N/A | +| `Connections` | [][operations.Connections](../../models/operations/connections.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindataauthenticationfeatures.md b/docs/models/operations/postuserssignindataauthenticationfeatures.md new file mode 100644 index 0000000..b628914 --- /dev/null +++ b/docs/models/operations/postuserssignindataauthenticationfeatures.md @@ -0,0 +1,66 @@ +# PostUsersSignInDataAuthenticationFeatures + + +## Values + +| Name | Value | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `PostUsersSignInDataAuthenticationFeaturesAndroidDolbyVision` | Android - Dolby Vision | +| `PostUsersSignInDataAuthenticationFeaturesAndroidPiP` | Android - PiP | +| `PostUsersSignInDataAuthenticationFeaturesCuSunset` | CU Sunset | +| `PostUsersSignInDataAuthenticationFeaturesHrkEnableEur` | HRK_enable_EUR | +| `PostUsersSignInDataAuthenticationFeaturesTrebleShowFeatures` | TREBLE-show-features | +| `PostUsersSignInDataAuthenticationFeaturesAdCountdownTimer` | ad-countdown-timer | +| `PostUsersSignInDataAuthenticationFeaturesAdaptiveBitrate` | adaptive_bitrate | +| `PostUsersSignInDataAuthenticationFeaturesAmazonLoopDebug` | amazon-loop-debug | +| `PostUsersSignInDataAuthenticationFeaturesAvodAdAnalysis` | avod-ad-analysis | +| `PostUsersSignInDataAuthenticationFeaturesAvodNewMedia` | avod-new-media | +| `PostUsersSignInDataAuthenticationFeaturesBlacklistGetSignin` | blacklist_get_signin | +| `PostUsersSignInDataAuthenticationFeaturesClientRadioStations` | client-radio-stations | +| `PostUsersSignInDataAuthenticationFeaturesCloudflareTurnstileRequired` | cloudflare-turnstile-required | +| `PostUsersSignInDataAuthenticationFeaturesCollections` | collections | +| `PostUsersSignInDataAuthenticationFeaturesCommentsAndRepliesPushNotifications` | comments_and_replies_push_notifications | +| `PostUsersSignInDataAuthenticationFeaturesCommunityAccessPlexTv` | community_access_plex_tv | +| `PostUsersSignInDataAuthenticationFeaturesCompanionsSonos` | companions_sonos | +| `PostUsersSignInDataAuthenticationFeaturesCustomHomeRemoval` | custom-home-removal | +| `PostUsersSignInDataAuthenticationFeaturesDisableHomeUserFriendships` | disable_home_user_friendships | +| `PostUsersSignInDataAuthenticationFeaturesDisableSharingFriendships` | disable_sharing_friendships | +| `PostUsersSignInDataAuthenticationFeaturesDrmSupport` | drm_support | +| `PostUsersSignInDataAuthenticationFeaturesExcludeRestrictions` | exclude restrictions | +| `PostUsersSignInDataAuthenticationFeaturesFederatedAuth` | federated-auth | +| `PostUsersSignInDataAuthenticationFeaturesFriendRequestPushNotifications` | friend_request_push_notifications | +| `PostUsersSignInDataAuthenticationFeaturesGuidedUpgrade` | guided-upgrade | +| `PostUsersSignInDataAuthenticationFeaturesHome` | home | +| `PostUsersSignInDataAuthenticationFeaturesIncreasePasswordComplexity` | increase-password-complexity | +| `PostUsersSignInDataAuthenticationFeaturesIos14PrivacyBanner` | ios14-privacy-banner | +| `PostUsersSignInDataAuthenticationFeaturesIterableNotificationTokens` | iterable-notification-tokens | +| `PostUsersSignInDataAuthenticationFeaturesKeepPaymentMethod` | keep-payment-method | +| `PostUsersSignInDataAuthenticationFeaturesKevinBacon` | kevin-bacon | +| `PostUsersSignInDataAuthenticationFeaturesKoreaConsent` | korea-consent | +| `PostUsersSignInDataAuthenticationFeaturesLeIsrgRootX1` | le_isrg_root_x1 | +| `PostUsersSignInDataAuthenticationFeaturesLetsEncrypt` | lets_encrypt | +| `PostUsersSignInDataAuthenticationFeaturesLightningDvrPivot` | lightning-dvr-pivot | +| `PostUsersSignInDataAuthenticationFeaturesLiveTvSupportIncompleteSegments` | live-tv-support-incomplete-segments | +| `PostUsersSignInDataAuthenticationFeaturesLivetv` | livetv | +| `PostUsersSignInDataAuthenticationFeaturesMetadataSearch` | metadata_search | +| `PostUsersSignInDataAuthenticationFeaturesNewPlexPassPrices` | new_plex_pass_prices | +| `PostUsersSignInDataAuthenticationFeaturesNewsProviderSunsetModal` | news-provider-sunset-modal | +| `PostUsersSignInDataAuthenticationFeaturesPhotosFavorites` | photos-favorites | +| `PostUsersSignInDataAuthenticationFeaturesPhotosMetadataEdition` | photos-metadata-edition | +| `PostUsersSignInDataAuthenticationFeaturesPmsHealth` | pms_health | +| `PostUsersSignInDataAuthenticationFeaturesRadio` | radio | +| `PostUsersSignInDataAuthenticationFeaturesRateLimitClientToken` | rate-limit-client-token | +| `PostUsersSignInDataAuthenticationFeaturesScrobblingServicePlexTv` | scrobbling-service-plex-tv | +| `PostUsersSignInDataAuthenticationFeaturesSharedServerNotification` | shared_server_notification | +| `PostUsersSignInDataAuthenticationFeaturesSharedSourceNotification` | shared_source_notification | +| `PostUsersSignInDataAuthenticationFeaturesSigninWithApple` | signin_with_apple | +| `PostUsersSignInDataAuthenticationFeaturesSpringServeAdProvider` | spring_serve_ad_provider | +| `PostUsersSignInDataAuthenticationFeaturesTranscoderCache` | transcoder_cache | +| `PostUsersSignInDataAuthenticationFeaturesTunerSharing` | tuner-sharing | +| `PostUsersSignInDataAuthenticationFeaturesTwoFactorAuthentication` | two-factor-authentication | +| `PostUsersSignInDataAuthenticationFeaturesUnsupportedtuners` | unsupportedtuners | +| `PostUsersSignInDataAuthenticationFeaturesUpgrade3ds2` | upgrade-3ds2 | +| `PostUsersSignInDataAuthenticationFeaturesVodSchema` | vod-schema | +| `PostUsersSignInDataAuthenticationFeaturesVodCloudflare` | vod_cloudflare | +| `PostUsersSignInDataAuthenticationFeaturesWatchTogetherInvite` | watch-together-invite | +| `PostUsersSignInDataAuthenticationFeaturesWebServerDashboard` | web_server_dashboard | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindataauthenticationresponsestatus.md b/docs/models/operations/postuserssignindataauthenticationresponsestatus.md new file mode 100644 index 0000000..357a1df --- /dev/null +++ b/docs/models/operations/postuserssignindataauthenticationresponsestatus.md @@ -0,0 +1,11 @@ +# PostUsersSignInDataAuthenticationResponseStatus + +String representation of subscriptionActive + + +## Values + +| Name | Value | +| --------------------------------------------------------- | --------------------------------------------------------- | +| `PostUsersSignInDataAuthenticationResponseStatusInactive` | Inactive | +| `PostUsersSignInDataAuthenticationResponseStatusActive` | Active | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindataauthenticationstatus.md b/docs/models/operations/postuserssignindataauthenticationstatus.md new file mode 100644 index 0000000..7ca0040 --- /dev/null +++ b/docs/models/operations/postuserssignindataauthenticationstatus.md @@ -0,0 +1,11 @@ +# PostUsersSignInDataAuthenticationStatus + +String representation of subscriptionActive + + +## Values + +| Name | Value | +| ------------------------------------------------- | ------------------------------------------------- | +| `PostUsersSignInDataAuthenticationStatusInactive` | Inactive | +| `PostUsersSignInDataAuthenticationStatusActive` | Active | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindataauthenticationsubscription.md b/docs/models/operations/postuserssignindataauthenticationsubscription.md new file mode 100644 index 0000000..d94289a --- /dev/null +++ b/docs/models/operations/postuserssignindataauthenticationsubscription.md @@ -0,0 +1,13 @@ +# PostUsersSignInDataAuthenticationSubscription + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `Features` | [][operations.PostUsersSignInDataAuthenticationFeatures](../../models/operations/postuserssignindataauthenticationfeatures.md) | :heavy_minus_sign: | List of features allowed on your Plex Pass subscription | | +| `Active` | **bool* | :heavy_minus_sign: | If the account's Plex Pass subscription is active | true | +| `SubscribedAt` | **string* | :heavy_minus_sign: | Date the account subscribed to Plex Pass | 2021-04-12T18:21:12Z | +| `Status` | [*operations.PostUsersSignInDataAuthenticationResponseStatus](../../models/operations/postuserssignindataauthenticationresponsestatus.md) | :heavy_minus_sign: | String representation of subscriptionActive | Inactive | +| `PaymentService` | **string* | :heavy_minus_sign: | Payment service used for your Plex Pass subscription | | +| `Plan` | **string* | :heavy_minus_sign: | Name of Plex Pass subscription plan | | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindataautoselectsubtitle.md b/docs/models/operations/postuserssignindataautoselectsubtitle.md new file mode 100644 index 0000000..0765f2b --- /dev/null +++ b/docs/models/operations/postuserssignindataautoselectsubtitle.md @@ -0,0 +1,11 @@ +# PostUsersSignInDataAutoSelectSubtitle + +The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) + + +## Values + +| Name | Value | +| ------------------------------------------- | ------------------------------------------- | +| `PostUsersSignInDataAutoSelectSubtitleZero` | 0 | +| `PostUsersSignInDataAutoSelectSubtitleOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatadefaultsubtitleaccessibility.md b/docs/models/operations/postuserssignindatadefaultsubtitleaccessibility.md new file mode 100644 index 0000000..e00c3c6 --- /dev/null +++ b/docs/models/operations/postuserssignindatadefaultsubtitleaccessibility.md @@ -0,0 +1,11 @@ +# PostUsersSignInDataDefaultSubtitleAccessibility + +The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) + + +## Values + +| Name | Value | +| ----------------------------------------------------- | ----------------------------------------------------- | +| `PostUsersSignInDataDefaultSubtitleAccessibilityZero` | 0 | +| `PostUsersSignInDataDefaultSubtitleAccessibilityOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatadefaultsubtitleforced.md b/docs/models/operations/postuserssignindatadefaultsubtitleforced.md new file mode 100644 index 0000000..b5ba6b7 --- /dev/null +++ b/docs/models/operations/postuserssignindatadefaultsubtitleforced.md @@ -0,0 +1,11 @@ +# PostUsersSignInDataDefaultSubtitleForced + +The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) + + +## Values + +| Name | Value | +| ---------------------------------------------- | ---------------------------------------------- | +| `PostUsersSignInDataDefaultSubtitleForcedZero` | 0 | +| `PostUsersSignInDataDefaultSubtitleForcedOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatafeatures.md b/docs/models/operations/postuserssignindatafeatures.md new file mode 100644 index 0000000..e19d812 --- /dev/null +++ b/docs/models/operations/postuserssignindatafeatures.md @@ -0,0 +1,66 @@ +# PostUsersSignInDataFeatures + + +## Values + +| Name | Value | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `PostUsersSignInDataFeaturesAndroidDolbyVision` | Android - Dolby Vision | +| `PostUsersSignInDataFeaturesAndroidPiP` | Android - PiP | +| `PostUsersSignInDataFeaturesCuSunset` | CU Sunset | +| `PostUsersSignInDataFeaturesHrkEnableEur` | HRK_enable_EUR | +| `PostUsersSignInDataFeaturesTrebleShowFeatures` | TREBLE-show-features | +| `PostUsersSignInDataFeaturesAdCountdownTimer` | ad-countdown-timer | +| `PostUsersSignInDataFeaturesAdaptiveBitrate` | adaptive_bitrate | +| `PostUsersSignInDataFeaturesAmazonLoopDebug` | amazon-loop-debug | +| `PostUsersSignInDataFeaturesAvodAdAnalysis` | avod-ad-analysis | +| `PostUsersSignInDataFeaturesAvodNewMedia` | avod-new-media | +| `PostUsersSignInDataFeaturesBlacklistGetSignin` | blacklist_get_signin | +| `PostUsersSignInDataFeaturesClientRadioStations` | client-radio-stations | +| `PostUsersSignInDataFeaturesCloudflareTurnstileRequired` | cloudflare-turnstile-required | +| `PostUsersSignInDataFeaturesCollections` | collections | +| `PostUsersSignInDataFeaturesCommentsAndRepliesPushNotifications` | comments_and_replies_push_notifications | +| `PostUsersSignInDataFeaturesCommunityAccessPlexTv` | community_access_plex_tv | +| `PostUsersSignInDataFeaturesCompanionsSonos` | companions_sonos | +| `PostUsersSignInDataFeaturesCustomHomeRemoval` | custom-home-removal | +| `PostUsersSignInDataFeaturesDisableHomeUserFriendships` | disable_home_user_friendships | +| `PostUsersSignInDataFeaturesDisableSharingFriendships` | disable_sharing_friendships | +| `PostUsersSignInDataFeaturesDrmSupport` | drm_support | +| `PostUsersSignInDataFeaturesExcludeRestrictions` | exclude restrictions | +| `PostUsersSignInDataFeaturesFederatedAuth` | federated-auth | +| `PostUsersSignInDataFeaturesFriendRequestPushNotifications` | friend_request_push_notifications | +| `PostUsersSignInDataFeaturesGuidedUpgrade` | guided-upgrade | +| `PostUsersSignInDataFeaturesHome` | home | +| `PostUsersSignInDataFeaturesIncreasePasswordComplexity` | increase-password-complexity | +| `PostUsersSignInDataFeaturesIos14PrivacyBanner` | ios14-privacy-banner | +| `PostUsersSignInDataFeaturesIterableNotificationTokens` | iterable-notification-tokens | +| `PostUsersSignInDataFeaturesKeepPaymentMethod` | keep-payment-method | +| `PostUsersSignInDataFeaturesKevinBacon` | kevin-bacon | +| `PostUsersSignInDataFeaturesKoreaConsent` | korea-consent | +| `PostUsersSignInDataFeaturesLeIsrgRootX1` | le_isrg_root_x1 | +| `PostUsersSignInDataFeaturesLetsEncrypt` | lets_encrypt | +| `PostUsersSignInDataFeaturesLightningDvrPivot` | lightning-dvr-pivot | +| `PostUsersSignInDataFeaturesLiveTvSupportIncompleteSegments` | live-tv-support-incomplete-segments | +| `PostUsersSignInDataFeaturesLivetv` | livetv | +| `PostUsersSignInDataFeaturesMetadataSearch` | metadata_search | +| `PostUsersSignInDataFeaturesNewPlexPassPrices` | new_plex_pass_prices | +| `PostUsersSignInDataFeaturesNewsProviderSunsetModal` | news-provider-sunset-modal | +| `PostUsersSignInDataFeaturesPhotosFavorites` | photos-favorites | +| `PostUsersSignInDataFeaturesPhotosMetadataEdition` | photos-metadata-edition | +| `PostUsersSignInDataFeaturesPmsHealth` | pms_health | +| `PostUsersSignInDataFeaturesRadio` | radio | +| `PostUsersSignInDataFeaturesRateLimitClientToken` | rate-limit-client-token | +| `PostUsersSignInDataFeaturesScrobblingServicePlexTv` | scrobbling-service-plex-tv | +| `PostUsersSignInDataFeaturesSharedServerNotification` | shared_server_notification | +| `PostUsersSignInDataFeaturesSharedSourceNotification` | shared_source_notification | +| `PostUsersSignInDataFeaturesSigninWithApple` | signin_with_apple | +| `PostUsersSignInDataFeaturesSpringServeAdProvider` | spring_serve_ad_provider | +| `PostUsersSignInDataFeaturesTranscoderCache` | transcoder_cache | +| `PostUsersSignInDataFeaturesTunerSharing` | tuner-sharing | +| `PostUsersSignInDataFeaturesTwoFactorAuthentication` | two-factor-authentication | +| `PostUsersSignInDataFeaturesUnsupportedtuners` | unsupportedtuners | +| `PostUsersSignInDataFeaturesUpgrade3ds2` | upgrade-3ds2 | +| `PostUsersSignInDataFeaturesVodSchema` | vod-schema | +| `PostUsersSignInDataFeaturesVodCloudflare` | vod_cloudflare | +| `PostUsersSignInDataFeaturesWatchTogetherInvite` | watch-together-invite | +| `PostUsersSignInDataFeaturesWebServerDashboard` | web_server_dashboard | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindataglobals.md b/docs/models/operations/postuserssignindataglobals.md new file mode 100644 index 0000000..363f6fa --- /dev/null +++ b/docs/models/operations/postuserssignindataglobals.md @@ -0,0 +1,8 @@ +# PostUsersSignInDataGlobals + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatamailingliststatus.md b/docs/models/operations/postuserssignindatamailingliststatus.md new file mode 100644 index 0000000..40752d3 --- /dev/null +++ b/docs/models/operations/postuserssignindatamailingliststatus.md @@ -0,0 +1,11 @@ +# PostUsersSignInDataMailingListStatus + +Your current mailing list status + + +## Values + +| Name | Value | +| -------------------------------------------------- | -------------------------------------------------- | +| `PostUsersSignInDataMailingListStatusActive` | active | +| `PostUsersSignInDataMailingListStatusUnsubscribed` | unsubscribed | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatamediareviewsvisibility.md b/docs/models/operations/postuserssignindatamediareviewsvisibility.md new file mode 100644 index 0000000..38f566c --- /dev/null +++ b/docs/models/operations/postuserssignindatamediareviewsvisibility.md @@ -0,0 +1,9 @@ +# PostUsersSignInDataMediaReviewsVisibility + + +## Values + +| Name | Value | +| ----------------------------------------------- | ----------------------------------------------- | +| `PostUsersSignInDataMediaReviewsVisibilityZero` | 0 | +| `PostUsersSignInDataMediaReviewsVisibilityOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatarequest.md b/docs/models/operations/postuserssignindatarequest.md new file mode 100644 index 0000000..7a4a8aa --- /dev/null +++ b/docs/models/operations/postuserssignindatarequest.md @@ -0,0 +1,9 @@ +# PostUsersSignInDataRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `XPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | +| `RequestBody` | [*operations.PostUsersSignInDataRequestBody](../../models/operations/postuserssignindatarequestbody.md) | :heavy_minus_sign: | Login credentials | | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatarequestbody.md b/docs/models/operations/postuserssignindatarequestbody.md new file mode 100644 index 0000000..cadfc27 --- /dev/null +++ b/docs/models/operations/postuserssignindatarequestbody.md @@ -0,0 +1,13 @@ +# PostUsersSignInDataRequestBody + +Login credentials + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | +| `Login` | *string* | :heavy_check_mark: | N/A | username@email.com | +| `Password` | *string* | :heavy_check_mark: | N/A | password123 | +| `RememberMe` | **bool* | :heavy_minus_sign: | N/A | | +| `VerificationCode` | **string* | :heavy_minus_sign: | N/A | 123456 | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindataresponse.md b/docs/models/operations/postuserssignindataresponse.md new file mode 100644 index 0000000..4d60e7a --- /dev/null +++ b/docs/models/operations/postuserssignindataresponse.md @@ -0,0 +1,11 @@ +# PostUsersSignInDataResponse + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | +| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | +| `UserPlexAccount` | [*operations.PostUsersSignInDataUserPlexAccount](../../models/operations/postuserssignindatauserplexaccount.md) | :heavy_minus_sign: | Returns the user account data with a valid auth token | {
"adsConsent": true,
"adsConsentReminderAt": "2019-08-24T14:15:22Z",
"adsConsentSetAt": "2019-08-24T14:15:22Z",
"anonymous": false,
"authToken": "CxoUzBTSV5hsxjTpFKaf",
"backupCodesCreated": false,
"confirmed": false,
"country": "US",
"email": "username@email.com",
"emailOnlyAuth": false,
"experimentalFeatures": false,
"friendlyName": "friendlyUsername",
"entitlements": [],
"guest": false,
"hasPassword": true,
"home": false,
"homeAdmin": false,
"homeSize": 1,
"id": 13692262,
"joinedAt": 1721154902,
"locale": null,
"mailingListActive": false,
"mailingListStatus": "subscribed",
"maxHomeSize": 15,
"pastSubscriptions": [
{
"id": "string",
"mode": "string",
"renewsAt": "string",
"endsAt": "1556281940",
"canceled": "0",
"gracePeriod": "0",
"onHold": "0",
"canReactivate": "0",
"canUpgrade": "0",
"canDowngrade": "0",
"canConvert": "0",
"type": "plexpass",
"transfer": "string",
"state": "ended",
"billing": [
{
"internalPaymentMethod": "string",
"paymentMethodId": "string"
}
]
}
],
"pin": "string",
"profile": [
{
"autoSelectAudio": true,
"defaultAudioLanguage": "ja",
"defaultSubtitleLanguage": "en",
"autoSelectSubtitle": 1,
"defaultSubtitleAccessibility": 1,
"defaultSubtitleForced": 0,
"watchedIndicator": 1,
"mediaReviewsVisibility": 0
}
],
"protected": false,
"rememberExpiresAt": 1722364046,
"restricted": false,
"roles": [
"string"
],
"scrobbleTypes": "",
"services": [
{
"identifier": "metadata-dev",
"endpoint": "https://epg.provider.plex.tv",
"token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv",
"secret": "string",
"status": "online"
}
],
"subscription": {
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
},
"subscriptionDescription": "string",
"subscriptions": [
{
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
}
],
"thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101",
"title": "UsernameTitle",
"trials": [
{}
],
"twoFactorEnabled": false,
"username": "Username",
"uuid": "dae343c1f45beb4f"
} | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindataservices.md b/docs/models/operations/postuserssignindataservices.md new file mode 100644 index 0000000..6453480 --- /dev/null +++ b/docs/models/operations/postuserssignindataservices.md @@ -0,0 +1,12 @@ +# PostUsersSignInDataServices + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Identifier` | *string* | :heavy_check_mark: | N/A | metadata-dev | +| `Endpoint` | *string* | :heavy_check_mark: | N/A | https://epg.provider.plex.tv | +| `Token` | *string* | :heavy_check_mark: | N/A | DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv | +| `Secret` | *string* | :heavy_check_mark: | N/A | | +| `Status` | [operations.PostUsersSignInDataStatus](../../models/operations/postuserssignindatastatus.md) | :heavy_check_mark: | N/A | online | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatastate.md b/docs/models/operations/postuserssignindatastate.md new file mode 100644 index 0000000..52cf607 --- /dev/null +++ b/docs/models/operations/postuserssignindatastate.md @@ -0,0 +1,8 @@ +# PostUsersSignInDataState + + +## Values + +| Name | Value | +| ------------------------------- | ------------------------------- | +| `PostUsersSignInDataStateEnded` | ended | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatastatus.md b/docs/models/operations/postuserssignindatastatus.md new file mode 100644 index 0000000..9c1762a --- /dev/null +++ b/docs/models/operations/postuserssignindatastatus.md @@ -0,0 +1,9 @@ +# PostUsersSignInDataStatus + + +## Values + +| Name | Value | +| ---------------------------------- | ---------------------------------- | +| `PostUsersSignInDataStatusOnline` | online | +| `PostUsersSignInDataStatusOffline` | offline | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatasubscription.md b/docs/models/operations/postuserssignindatasubscription.md new file mode 100644 index 0000000..49591ef --- /dev/null +++ b/docs/models/operations/postuserssignindatasubscription.md @@ -0,0 +1,15 @@ +# PostUsersSignInDataSubscription + +If the account’s Plex Pass subscription is active + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `Features` | [][operations.PostUsersSignInDataFeatures](../../models/operations/postuserssignindatafeatures.md) | :heavy_minus_sign: | List of features allowed on your Plex Pass subscription | | +| `Active` | **bool* | :heavy_minus_sign: | If the account's Plex Pass subscription is active | true | +| `SubscribedAt` | **string* | :heavy_minus_sign: | Date the account subscribed to Plex Pass | 2021-04-12T18:21:12Z | +| `Status` | [*operations.PostUsersSignInDataAuthenticationStatus](../../models/operations/postuserssignindataauthenticationstatus.md) | :heavy_minus_sign: | String representation of subscriptionActive | Inactive | +| `PaymentService` | **string* | :heavy_minus_sign: | Payment service used for your Plex Pass subscription | | +| `Plan` | **string* | :heavy_minus_sign: | Name of Plex Pass subscription plan | | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatauserplexaccount.md b/docs/models/operations/postuserssignindatauserplexaccount.md new file mode 100644 index 0000000..4647f9c --- /dev/null +++ b/docs/models/operations/postuserssignindatauserplexaccount.md @@ -0,0 +1,51 @@ +# PostUsersSignInDataUserPlexAccount + +Returns the user account data with a valid auth token + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AdsConsent` | *bool* | :heavy_check_mark: | Unknown | | +| `AdsConsentReminderAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Unknown | | +| `AdsConsentSetAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Unknown | | +| `Anonymous` | **bool* | :heavy_minus_sign: | Unknown | | +| `AuthToken` | *string* | :heavy_check_mark: | The account token | CxoUzBTSV5hsxjTpFKaf | +| `BackupCodesCreated` | **bool* | :heavy_minus_sign: | If the two-factor authentication backup codes have been created | | +| `Confirmed` | **bool* | :heavy_minus_sign: | If the account has been confirmed | | +| `Country` | *string* | :heavy_check_mark: | The account country | US | +| `Email` | *string* | :heavy_check_mark: | The account email address | username@email.com | +| `EmailOnlyAuth` | **bool* | :heavy_minus_sign: | If login with email only is enabled | | +| `ExperimentalFeatures` | **bool* | :heavy_minus_sign: | If experimental features are enabled | | +| `FriendlyName` | *string* | :heavy_check_mark: | Your account full name | friendlyUsername | +| `Entitlements` | []*string* | :heavy_check_mark: | List of devices your allowed to use with this account | | +| `Guest` | **bool* | :heavy_minus_sign: | If the account is a Plex Home guest user | | +| `HasPassword` | **bool* | :heavy_minus_sign: | If the account has a password | | +| `Home` | **bool* | :heavy_minus_sign: | If the account is a Plex Home user | | +| `HomeAdmin` | **bool* | :heavy_minus_sign: | If the account is the Plex Home admin | | +| `HomeSize` | *int* | :heavy_check_mark: | The number of accounts in the Plex Home | 1 | +| `ID` | *int* | :heavy_check_mark: | The Plex account ID | 13692262 | +| `JoinedAt` | *int64* | :heavy_check_mark: | Unix epoch datetime | 1556281940 | +| `Locale` | *string* | :heavy_check_mark: | The account locale | | +| `MailingListActive` | **bool* | :heavy_minus_sign: | If you are subscribed to the Plex newsletter | | +| `MailingListStatus` | [operations.PostUsersSignInDataMailingListStatus](../../models/operations/postuserssignindatamailingliststatus.md) | :heavy_check_mark: | Your current mailing list status | | +| `MaxHomeSize` | *int* | :heavy_check_mark: | The maximum number of accounts allowed in the Plex Home | 15 | +| ~~`Pin`~~ | **string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.

[Might be removed] The hashed Plex Home PIN | | +| `Profile` | [operations.PostUsersSignInDataUserProfile](../../models/operations/postuserssignindatauserprofile.md) | :heavy_check_mark: | N/A | | +| `Protected` | **bool* | :heavy_minus_sign: | If the account has a Plex Home PIN enabled | | +| `RememberExpiresAt` | *int64* | :heavy_check_mark: | Unix epoch datetime | 1556281940 | +| `Restricted` | **bool* | :heavy_minus_sign: | If the account is a Plex Home managed user | | +| `Roles` | []*string* | :heavy_minus_sign: | [Might be removed] List of account roles. Plexpass membership listed here | | +| `ScrobbleTypes` | *string* | :heavy_check_mark: | Unknown | | +| `Services` | [][operations.PostUsersSignInDataServices](../../models/operations/postuserssignindataservices.md) | :heavy_check_mark: | N/A | | +| `Subscription` | [operations.PostUsersSignInDataSubscription](../../models/operations/postuserssignindatasubscription.md) | :heavy_check_mark: | If the account’s Plex Pass subscription is active | | +| `SubscriptionDescription` | *string* | :heavy_check_mark: | Description of the Plex Pass subscription | | +| `Subscriptions` | [][operations.PostUsersSignInDataAuthenticationSubscription](../../models/operations/postuserssignindataauthenticationsubscription.md) | :heavy_check_mark: | N/A | | +| `Thumb` | *string* | :heavy_check_mark: | URL of the account thumbnail | https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101 | +| `Title` | *string* | :heavy_check_mark: | The title of the account (username or friendly name) | UsernameTitle | +| `TwoFactorEnabled` | **bool* | :heavy_minus_sign: | If two-factor authentication is enabled | | +| `Username` | *string* | :heavy_check_mark: | The account username | Username | +| `UUID` | *string* | :heavy_check_mark: | The account UUID | dae343c1f45beb4f | +| `PastSubscriptions` | [][operations.PastSubscription](../../models/operations/pastsubscription.md) | :heavy_check_mark: | N/A | | +| `Trials` | [][operations.Trials](../../models/operations/trials.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatauserprofile.md b/docs/models/operations/postuserssignindatauserprofile.md new file mode 100644 index 0000000..61a239f --- /dev/null +++ b/docs/models/operations/postuserssignindatauserprofile.md @@ -0,0 +1,15 @@ +# PostUsersSignInDataUserProfile + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AutoSelectAudio` | **bool* | :heavy_minus_sign: | If the account has automatically select audio and subtitle tracks enabled | true | +| `DefaultAudioLanguage` | *string* | :heavy_check_mark: | The preferred audio language for the account | ja | +| `DefaultSubtitleLanguage` | *string* | :heavy_check_mark: | The preferred subtitle language for the account | en | +| `AutoSelectSubtitle` | [*operations.PostUsersSignInDataAutoSelectSubtitle](../../models/operations/postuserssignindataautoselectsubtitle.md) | :heavy_minus_sign: | The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) | 1 | +| `DefaultSubtitleAccessibility` | [*operations.PostUsersSignInDataDefaultSubtitleAccessibility](../../models/operations/postuserssignindatadefaultsubtitleaccessibility.md) | :heavy_minus_sign: | The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) | 1 | +| `DefaultSubtitleForced` | [*operations.PostUsersSignInDataDefaultSubtitleForced](../../models/operations/postuserssignindatadefaultsubtitleforced.md) | :heavy_minus_sign: | The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) | 0 | +| `WatchedIndicator` | [*operations.PostUsersSignInDataWatchedIndicator](../../models/operations/postuserssignindatawatchedindicator.md) | :heavy_minus_sign: | N/A | 1 | +| `MediaReviewsVisibility` | [*operations.PostUsersSignInDataMediaReviewsVisibility](../../models/operations/postuserssignindatamediareviewsvisibility.md) | :heavy_minus_sign: | N/A | 0 | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatawatchedindicator.md b/docs/models/operations/postuserssignindatawatchedindicator.md new file mode 100644 index 0000000..e4ed74c --- /dev/null +++ b/docs/models/operations/postuserssignindatawatchedindicator.md @@ -0,0 +1,9 @@ +# PostUsersSignInDataWatchedIndicator + + +## Values + +| Name | Value | +| ----------------------------------------- | ----------------------------------------- | +| `PostUsersSignInDataWatchedIndicatorZero` | 0 | +| `PostUsersSignInDataWatchedIndicatorOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/queryparamfilter.md b/docs/models/operations/queryparamfilter.md new file mode 100644 index 0000000..7167549 --- /dev/null +++ b/docs/models/operations/queryparamfilter.md @@ -0,0 +1,11 @@ +# QueryParamFilter + +Filters content by field and direction/equality +(Unknown if viewedAt is the only supported column) + + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/queryparamforce.md b/docs/models/operations/queryparamforce.md new file mode 100644 index 0000000..4128116 --- /dev/null +++ b/docs/models/operations/queryparamforce.md @@ -0,0 +1,15 @@ +# QueryParamForce + +Force overwriting of duplicate playlists. +By default, a playlist file uploaded with the same path will overwrite the existing playlist. +The `force` argument is used to disable overwriting. +If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded. + + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `QueryParamForceZero` | 0 | +| `QueryParamForceOne` | 1 | \ No newline at end of file diff --git a/docs/models/operations/queryparamtype.md b/docs/models/operations/queryparamtype.md index 294587e..bdb68e2 100644 --- a/docs/models/operations/queryparamtype.md +++ b/docs/models/operations/queryparamtype.md @@ -1,12 +1,19 @@ # QueryParamType -type of playlist to create +The type of media to retrieve. +1 = movie +2 = show +3 = season +4 = episode +E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries + ## Values | Name | Value | | --------------------- | --------------------- | -| `QueryParamTypeAudio` | audio | -| `QueryParamTypeVideo` | video | -| `QueryParamTypePhoto` | photo | \ No newline at end of file +| `QueryParamTypeOne` | 1 | +| `QueryParamTypeTwo` | 2 | +| `QueryParamTypeThree` | 3 | +| `QueryParamTypeFour` | 4 | \ No newline at end of file diff --git a/docs/models/operations/refreshlibraryrequest.md b/docs/models/operations/refreshlibraryrequest.md deleted file mode 100644 index aaa03d8..0000000 --- a/docs/models/operations/refreshlibraryrequest.md +++ /dev/null @@ -1,8 +0,0 @@ -# RefreshLibraryRequest - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------- | -------------------------------- | -------------------------------- | -------------------------------- | -| `SectionID` | *float64* | :heavy_check_mark: | the Id of the library to refresh | \ No newline at end of file diff --git a/docs/models/operations/responsebody.md b/docs/models/operations/responsebody.md new file mode 100644 index 0000000..224469e --- /dev/null +++ b/docs/models/operations/responsebody.md @@ -0,0 +1,13 @@ +# ResponseBody + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| `Identifier` | *string* | :heavy_check_mark: | N/A | tv.plex.sonos | +| `BaseURL` | *string* | :heavy_check_mark: | N/A | https://sonos.plex.tv | +| `Title` | *string* | :heavy_check_mark: | N/A | Sonos | +| `LinkURL` | *string* | :heavy_check_mark: | N/A | https://sonos.plex.tv/link | +| `Provides` | *string* | :heavy_check_mark: | N/A | client,player | +| `Token` | *string* | :heavy_check_mark: | The plex authtoken used to identify with | | \ No newline at end of file diff --git a/docs/models/operations/searchlibrarymediacontainer.md b/docs/models/operations/searchlibrarymediacontainer.md deleted file mode 100644 index 8b533c4..0000000 --- a/docs/models/operations/searchlibrarymediacontainer.md +++ /dev/null @@ -1,20 +0,0 @@ -# SearchLibraryMediaContainer - - -## Fields - -| Field | Type | Required | Description | Example | -| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -| `Size` | **int* | :heavy_minus_sign: | N/A | 2 | -| `AllowSync` | **bool* | :heavy_minus_sign: | N/A | false | -| `Art` | **string* | :heavy_minus_sign: | N/A | /:/resources/show-fanart.jpg | -| `Identifier` | **string* | :heavy_minus_sign: | N/A | com.plexapp.plugins.library | -| `MediaTagPrefix` | **string* | :heavy_minus_sign: | N/A | /system/bundle/media/flags/ | -| `MediaTagVersion` | **int* | :heavy_minus_sign: | N/A | 1698860922 | -| `Nocache` | **bool* | :heavy_minus_sign: | N/A | true | -| `Thumb` | **string* | :heavy_minus_sign: | N/A | /:/resources/show.png | -| `Title1` | **string* | :heavy_minus_sign: | N/A | TV Shows | -| `Title2` | **string* | :heavy_minus_sign: | N/A | Search for '' | -| `ViewGroup` | **string* | :heavy_minus_sign: | N/A | season | -| `ViewMode` | **int* | :heavy_minus_sign: | N/A | 65593 | -| `Metadata` | [][operations.SearchLibraryMetadata](../../models/operations/searchlibrarymetadata.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/searchlibraryrequest.md b/docs/models/operations/searchlibraryrequest.md deleted file mode 100644 index 273170b..0000000 --- a/docs/models/operations/searchlibraryrequest.md +++ /dev/null @@ -1,9 +0,0 @@ -# SearchLibraryRequest - - -## Fields - -| Field | Type | Required | Description | -| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -| `SectionID` | *int64* | :heavy_check_mark: | the Id of the library to query | -| `Type` | [operations.Type](../../models/operations/type.md) | :heavy_check_mark: | Plex content type to search for | \ No newline at end of file diff --git a/docs/models/operations/searchlibraryresponse.md b/docs/models/operations/searchlibraryresponse.md deleted file mode 100644 index 08d3a17..0000000 --- a/docs/models/operations/searchlibraryresponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# SearchLibraryResponse - - -## Fields - -| Field | Type | Required | Description | -| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | -| `Object` | [*operations.SearchLibraryResponseBody](../../models/operations/searchlibraryresponsebody.md) | :heavy_minus_sign: | The contents of the library by section and type | \ No newline at end of file diff --git a/docs/models/operations/searchlibraryresponsebody.md b/docs/models/operations/searchlibraryresponsebody.md deleted file mode 100644 index 4de3cc8..0000000 --- a/docs/models/operations/searchlibraryresponsebody.md +++ /dev/null @@ -1,10 +0,0 @@ -# SearchLibraryResponseBody - -The contents of the library by section and type - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | -| `MediaContainer` | [*operations.SearchLibraryMediaContainer](../../models/operations/searchlibrarymediacontainer.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/services.md b/docs/models/operations/services.md new file mode 100644 index 0000000..0226e33 --- /dev/null +++ b/docs/models/operations/services.md @@ -0,0 +1,12 @@ +# Services + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `Identifier` | *string* | :heavy_check_mark: | N/A | metadata-dev | +| `Endpoint` | *string* | :heavy_check_mark: | N/A | https://epg.provider.plex.tv | +| `Token` | *string* | :heavy_check_mark: | N/A | DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv | +| `Secret` | *string* | :heavy_check_mark: | N/A | | +| `Status` | [operations.GetUserDetailsStatus](../../models/operations/getuserdetailsstatus.md) | :heavy_check_mark: | N/A | online | \ No newline at end of file diff --git a/docs/models/operations/sharedservers.md b/docs/models/operations/sharedservers.md new file mode 100644 index 0000000..d787f3b --- /dev/null +++ b/docs/models/operations/sharedservers.md @@ -0,0 +1,7 @@ +# SharedServers + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/sharedsources.md b/docs/models/operations/sharedsources.md new file mode 100644 index 0000000..ca74299 --- /dev/null +++ b/docs/models/operations/sharedsources.md @@ -0,0 +1,7 @@ +# SharedSources + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/skip.md b/docs/models/operations/skip.md index c44166a..8338409 100644 --- a/docs/models/operations/skip.md +++ b/docs/models/operations/skip.md @@ -1,6 +1,6 @@ # Skip -Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. +Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`. ## Values diff --git a/docs/models/operations/statisticsbandwidth.md b/docs/models/operations/statisticsbandwidth.md index 83f4294..3585455 100644 --- a/docs/models/operations/statisticsbandwidth.md +++ b/docs/models/operations/statisticsbandwidth.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | Example | | ------------------ | ------------------ | ------------------ | ------------------ | ------------------ | | `AccountID` | **int* | :heavy_minus_sign: | N/A | 238960586 | -| `DeviceID` | **int* | :heavy_minus_sign: | N/A | | +| `DeviceID` | **int* | :heavy_minus_sign: | N/A | 208 | | `Timespan` | **int64* | :heavy_minus_sign: | N/A | 6 | | `At` | **int* | :heavy_minus_sign: | N/A | 1718387650 | | `Lan` | **bool* | :heavy_minus_sign: | N/A | true | diff --git a/docs/models/operations/status.md b/docs/models/operations/status.md new file mode 100644 index 0000000..a9d9d40 --- /dev/null +++ b/docs/models/operations/status.md @@ -0,0 +1,10 @@ +# Status + +Current friend request status + + +## Values + +| Name | Value | +| ---------------- | ---------------- | +| `StatusAccepted` | accepted | \ No newline at end of file diff --git a/docs/models/operations/subscription.md b/docs/models/operations/subscription.md new file mode 100644 index 0000000..26dad6e --- /dev/null +++ b/docs/models/operations/subscription.md @@ -0,0 +1,15 @@ +# Subscription + +If the account’s Plex Pass subscription is active + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `Features` | [][operations.Features](../../models/operations/features.md) | :heavy_minus_sign: | List of features allowed on your Plex Pass subscription | | +| `Active` | **bool* | :heavy_minus_sign: | If the account's Plex Pass subscription is active | true | +| `SubscribedAt` | **string* | :heavy_minus_sign: | Date the account subscribed to Plex Pass | 2021-04-12T18:21:12Z | +| `Status` | [*operations.GetUserDetailsAuthenticationStatus](../../models/operations/getuserdetailsauthenticationstatus.md) | :heavy_minus_sign: | String representation of subscriptionActive | Inactive | +| `PaymentService` | **string* | :heavy_minus_sign: | Payment service used for your Plex Pass subscription | | +| `Plan` | **string* | :heavy_minus_sign: | Name of Plex Pass subscription plan | | \ No newline at end of file diff --git a/docs/models/operations/trials.md b/docs/models/operations/trials.md new file mode 100644 index 0000000..1b9b77d --- /dev/null +++ b/docs/models/operations/trials.md @@ -0,0 +1,7 @@ +# Trials + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/type.md b/docs/models/operations/type.md index bd68927..0f4eaee 100644 --- a/docs/models/operations/type.md +++ b/docs/models/operations/type.md @@ -1,6 +1,12 @@ # Type -Plex content type to search for +The type of media to retrieve. +1 = movie +2 = show +3 = season +4 = episode +E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries + ## Values diff --git a/docs/models/operations/uploadplaylistrequest.md b/docs/models/operations/uploadplaylistrequest.md index d6f37d3..b007e2c 100644 --- a/docs/models/operations/uploadplaylistrequest.md +++ b/docs/models/operations/uploadplaylistrequest.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Path` | *string* | :heavy_check_mark: | absolute path to a directory on the server where m3u files are stored, or the absolute path to a playlist file on the server.
If the `path` argument is a directory, that path will be scanned for playlist files to be processed.
Each file in that directory creates a separate playlist, with a name based on the filename of the file that created it.
The GUID of each playlist is based on the filename.
If the `path` argument is a file, that file will be used to create a new playlist, with the name based on the filename of the file that created it.
The GUID of each playlist is based on the filename.
| /home/barkley/playlist.m3u | -| `Force` | [operations.Force](../../models/operations/force.md) | :heavy_check_mark: | Force overwriting of duplicate playlists.
By default, a playlist file uploaded with the same path will overwrite the existing playlist.
The `force` argument is used to disable overwriting.
If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
| | \ No newline at end of file +| `Force` | [operations.QueryParamForce](../../models/operations/queryparamforce.md) | :heavy_check_mark: | Force overwriting of duplicate playlists.
By default, a playlist file uploaded with the same path will overwrite the existing playlist.
The `force` argument is used to disable overwriting.
If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
| | \ No newline at end of file diff --git a/docs/models/operations/userprofile.md b/docs/models/operations/userprofile.md new file mode 100644 index 0000000..471539e --- /dev/null +++ b/docs/models/operations/userprofile.md @@ -0,0 +1,15 @@ +# UserProfile + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AutoSelectAudio` | **bool* | :heavy_minus_sign: | If the account has automatically select audio and subtitle tracks enabled | true | +| `DefaultAudioLanguage` | *string* | :heavy_check_mark: | The preferred audio language for the account | ja | +| `DefaultSubtitleLanguage` | *string* | :heavy_check_mark: | The preferred subtitle language for the account | en | +| `AutoSelectSubtitle` | [*operations.AutoSelectSubtitle](../../models/operations/autoselectsubtitle.md) | :heavy_minus_sign: | The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) | 1 | +| `DefaultSubtitleAccessibility` | [*operations.DefaultSubtitleAccessibility](../../models/operations/defaultsubtitleaccessibility.md) | :heavy_minus_sign: | The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) | 1 | +| `DefaultSubtitleForced` | [*operations.DefaultSubtitleForced](../../models/operations/defaultsubtitleforced.md) | :heavy_minus_sign: | The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) | 0 | +| `WatchedIndicator` | [*operations.WatchedIndicator](../../models/operations/watchedindicator.md) | :heavy_minus_sign: | N/A | 1 | +| `MediaReviewsVisibility` | [*operations.MediaReviewsVisibility](../../models/operations/mediareviewsvisibility.md) | :heavy_minus_sign: | N/A | 0 | \ No newline at end of file diff --git a/docs/models/operations/watchedindicator.md b/docs/models/operations/watchedindicator.md new file mode 100644 index 0000000..5aa2686 --- /dev/null +++ b/docs/models/operations/watchedindicator.md @@ -0,0 +1,9 @@ +# WatchedIndicator + + +## Values + +| Name | Value | +| ---------------------- | ---------------------- | +| `WatchedIndicatorZero` | 0 | +| `WatchedIndicatorOne` | 1 | \ No newline at end of file diff --git a/docs/models/sdkerrors/addplaylistcontentserrors.md b/docs/models/sdkerrors/addplaylistcontentserrors.md index a1afd8a..03d8e83 100644 --- a/docs/models/sdkerrors/addplaylistcontentserrors.md +++ b/docs/models/sdkerrors/addplaylistcontentserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/addplaylistcontentsplaylistserrors.md b/docs/models/sdkerrors/addplaylistcontentsplaylistserrors.md new file mode 100644 index 0000000..53db431 --- /dev/null +++ b/docs/models/sdkerrors/addplaylistcontentsplaylistserrors.md @@ -0,0 +1,10 @@ +# AddPlaylistContentsPlaylistsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/addplaylistcontentsplaylistsresponsebody.md b/docs/models/sdkerrors/addplaylistcontentsplaylistsresponsebody.md new file mode 100644 index 0000000..e7390d2 --- /dev/null +++ b/docs/models/sdkerrors/addplaylistcontentsplaylistsresponsebody.md @@ -0,0 +1,11 @@ +# AddPlaylistContentsPlaylistsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.AddPlaylistContentsPlaylistsErrors](../../models/sdkerrors/addplaylistcontentsplaylistserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/addplaylistcontentsresponsebody.md b/docs/models/sdkerrors/addplaylistcontentsresponsebody.md index 93a8338..bfd9f19 100644 --- a/docs/models/sdkerrors/addplaylistcontentsresponsebody.md +++ b/docs/models/sdkerrors/addplaylistcontentsresponsebody.md @@ -1,6 +1,6 @@ # AddPlaylistContentsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/applyupdateserrors.md b/docs/models/sdkerrors/applyupdateserrors.md index 5fa1fc4..1d69fa8 100644 --- a/docs/models/sdkerrors/applyupdateserrors.md +++ b/docs/models/sdkerrors/applyupdateserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/applyupdatesresponsebody.md b/docs/models/sdkerrors/applyupdatesresponsebody.md index 3d8d4b9..47be49f 100644 --- a/docs/models/sdkerrors/applyupdatesresponsebody.md +++ b/docs/models/sdkerrors/applyupdatesresponsebody.md @@ -1,6 +1,6 @@ # ApplyUpdatesResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/applyupdatesupdatererrors.md b/docs/models/sdkerrors/applyupdatesupdatererrors.md new file mode 100644 index 0000000..62a4fff --- /dev/null +++ b/docs/models/sdkerrors/applyupdatesupdatererrors.md @@ -0,0 +1,10 @@ +# ApplyUpdatesUpdaterErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/applyupdatesupdaterresponsebody.md b/docs/models/sdkerrors/applyupdatesupdaterresponsebody.md new file mode 100644 index 0000000..4452b35 --- /dev/null +++ b/docs/models/sdkerrors/applyupdatesupdaterresponsebody.md @@ -0,0 +1,11 @@ +# ApplyUpdatesUpdaterResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.ApplyUpdatesUpdaterErrors](../../models/sdkerrors/applyupdatesupdatererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/cancelserveractivitiesactivitieserrors.md b/docs/models/sdkerrors/cancelserveractivitiesactivitieserrors.md new file mode 100644 index 0000000..63b63ae --- /dev/null +++ b/docs/models/sdkerrors/cancelserveractivitiesactivitieserrors.md @@ -0,0 +1,10 @@ +# CancelServerActivitiesActivitiesErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/cancelserveractivitiesactivitiesresponsebody.md b/docs/models/sdkerrors/cancelserveractivitiesactivitiesresponsebody.md new file mode 100644 index 0000000..ed94742 --- /dev/null +++ b/docs/models/sdkerrors/cancelserveractivitiesactivitiesresponsebody.md @@ -0,0 +1,11 @@ +# CancelServerActivitiesActivitiesResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.CancelServerActivitiesActivitiesErrors](../../models/sdkerrors/cancelserveractivitiesactivitieserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/cancelserveractivitieserrors.md b/docs/models/sdkerrors/cancelserveractivitieserrors.md index 0630a47..4be46d1 100644 --- a/docs/models/sdkerrors/cancelserveractivitieserrors.md +++ b/docs/models/sdkerrors/cancelserveractivitieserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/cancelserveractivitiesresponsebody.md b/docs/models/sdkerrors/cancelserveractivitiesresponsebody.md index f2ed161..fc38062 100644 --- a/docs/models/sdkerrors/cancelserveractivitiesresponsebody.md +++ b/docs/models/sdkerrors/cancelserveractivitiesresponsebody.md @@ -1,6 +1,6 @@ # CancelServerActivitiesResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/checkforupdateserrors.md b/docs/models/sdkerrors/checkforupdateserrors.md index 9c13e85..b30658a 100644 --- a/docs/models/sdkerrors/checkforupdateserrors.md +++ b/docs/models/sdkerrors/checkforupdateserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/checkforupdatesresponsebody.md b/docs/models/sdkerrors/checkforupdatesresponsebody.md index 548d0dc..aeea4d9 100644 --- a/docs/models/sdkerrors/checkforupdatesresponsebody.md +++ b/docs/models/sdkerrors/checkforupdatesresponsebody.md @@ -1,6 +1,6 @@ # CheckForUpdatesResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/checkforupdatesupdatererrors.md b/docs/models/sdkerrors/checkforupdatesupdatererrors.md new file mode 100644 index 0000000..f77ea82 --- /dev/null +++ b/docs/models/sdkerrors/checkforupdatesupdatererrors.md @@ -0,0 +1,10 @@ +# CheckForUpdatesUpdaterErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/checkforupdatesupdaterresponsebody.md b/docs/models/sdkerrors/checkforupdatesupdaterresponsebody.md new file mode 100644 index 0000000..12fca4d --- /dev/null +++ b/docs/models/sdkerrors/checkforupdatesupdaterresponsebody.md @@ -0,0 +1,11 @@ +# CheckForUpdatesUpdaterResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.CheckForUpdatesUpdaterErrors](../../models/sdkerrors/checkforupdatesupdatererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/clearplaylistcontentserrors.md b/docs/models/sdkerrors/clearplaylistcontentserrors.md index 94c6f96..dab1321 100644 --- a/docs/models/sdkerrors/clearplaylistcontentserrors.md +++ b/docs/models/sdkerrors/clearplaylistcontentserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/clearplaylistcontentsplaylistserrors.md b/docs/models/sdkerrors/clearplaylistcontentsplaylistserrors.md new file mode 100644 index 0000000..354f773 --- /dev/null +++ b/docs/models/sdkerrors/clearplaylistcontentsplaylistserrors.md @@ -0,0 +1,10 @@ +# ClearPlaylistContentsPlaylistsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/clearplaylistcontentsplaylistsresponsebody.md b/docs/models/sdkerrors/clearplaylistcontentsplaylistsresponsebody.md new file mode 100644 index 0000000..90c78f7 --- /dev/null +++ b/docs/models/sdkerrors/clearplaylistcontentsplaylistsresponsebody.md @@ -0,0 +1,11 @@ +# ClearPlaylistContentsPlaylistsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.ClearPlaylistContentsPlaylistsErrors](../../models/sdkerrors/clearplaylistcontentsplaylistserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/clearplaylistcontentsresponsebody.md b/docs/models/sdkerrors/clearplaylistcontentsresponsebody.md index df0b78d..4b2f55f 100644 --- a/docs/models/sdkerrors/clearplaylistcontentsresponsebody.md +++ b/docs/models/sdkerrors/clearplaylistcontentsresponsebody.md @@ -1,6 +1,6 @@ # ClearPlaylistContentsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/createplaylisterrors.md b/docs/models/sdkerrors/createplaylisterrors.md index fa2a38d..9a8c91b 100644 --- a/docs/models/sdkerrors/createplaylisterrors.md +++ b/docs/models/sdkerrors/createplaylisterrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/createplaylistplaylistserrors.md b/docs/models/sdkerrors/createplaylistplaylistserrors.md new file mode 100644 index 0000000..bb86bfb --- /dev/null +++ b/docs/models/sdkerrors/createplaylistplaylistserrors.md @@ -0,0 +1,10 @@ +# CreatePlaylistPlaylistsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/createplaylistplaylistsresponsebody.md b/docs/models/sdkerrors/createplaylistplaylistsresponsebody.md new file mode 100644 index 0000000..51f6794 --- /dev/null +++ b/docs/models/sdkerrors/createplaylistplaylistsresponsebody.md @@ -0,0 +1,11 @@ +# CreatePlaylistPlaylistsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.CreatePlaylistPlaylistsErrors](../../models/sdkerrors/createplaylistplaylistserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/createplaylistresponsebody.md b/docs/models/sdkerrors/createplaylistresponsebody.md index e229fd9..5425fdb 100644 --- a/docs/models/sdkerrors/createplaylistresponsebody.md +++ b/docs/models/sdkerrors/createplaylistresponsebody.md @@ -1,6 +1,6 @@ # CreatePlaylistResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/deletelibraryerrors.md b/docs/models/sdkerrors/deletelibraryerrors.md index 6818889..3766eff 100644 --- a/docs/models/sdkerrors/deletelibraryerrors.md +++ b/docs/models/sdkerrors/deletelibraryerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/deletelibrarylibraryerrors.md b/docs/models/sdkerrors/deletelibrarylibraryerrors.md new file mode 100644 index 0000000..ecbc356 --- /dev/null +++ b/docs/models/sdkerrors/deletelibrarylibraryerrors.md @@ -0,0 +1,10 @@ +# DeleteLibraryLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/deletelibrarylibraryresponsebody.md b/docs/models/sdkerrors/deletelibrarylibraryresponsebody.md new file mode 100644 index 0000000..75241b5 --- /dev/null +++ b/docs/models/sdkerrors/deletelibrarylibraryresponsebody.md @@ -0,0 +1,11 @@ +# DeleteLibraryLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.DeleteLibraryLibraryErrors](../../models/sdkerrors/deletelibrarylibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/deletelibraryresponsebody.md b/docs/models/sdkerrors/deletelibraryresponsebody.md index 282ad40..c6824bf 100644 --- a/docs/models/sdkerrors/deletelibraryresponsebody.md +++ b/docs/models/sdkerrors/deletelibraryresponsebody.md @@ -1,6 +1,6 @@ # DeleteLibraryResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/deleteplaylisterrors.md b/docs/models/sdkerrors/deleteplaylisterrors.md index 78ff713..cf5d7d7 100644 --- a/docs/models/sdkerrors/deleteplaylisterrors.md +++ b/docs/models/sdkerrors/deleteplaylisterrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/deleteplaylistplaylistserrors.md b/docs/models/sdkerrors/deleteplaylistplaylistserrors.md new file mode 100644 index 0000000..310f9ee --- /dev/null +++ b/docs/models/sdkerrors/deleteplaylistplaylistserrors.md @@ -0,0 +1,10 @@ +# DeletePlaylistPlaylistsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/deleteplaylistplaylistsresponsebody.md b/docs/models/sdkerrors/deleteplaylistplaylistsresponsebody.md new file mode 100644 index 0000000..9a7cfb9 --- /dev/null +++ b/docs/models/sdkerrors/deleteplaylistplaylistsresponsebody.md @@ -0,0 +1,11 @@ +# DeletePlaylistPlaylistsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.DeletePlaylistPlaylistsErrors](../../models/sdkerrors/deleteplaylistplaylistserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/deleteplaylistresponsebody.md b/docs/models/sdkerrors/deleteplaylistresponsebody.md index 03fb748..03c8b44 100644 --- a/docs/models/sdkerrors/deleteplaylistresponsebody.md +++ b/docs/models/sdkerrors/deleteplaylistresponsebody.md @@ -1,6 +1,6 @@ # DeletePlaylistResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/enablepapertrailerrors.md b/docs/models/sdkerrors/enablepapertrailerrors.md index 173d7cb..6b79763 100644 --- a/docs/models/sdkerrors/enablepapertrailerrors.md +++ b/docs/models/sdkerrors/enablepapertrailerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/enablepapertraillogerrors.md b/docs/models/sdkerrors/enablepapertraillogerrors.md new file mode 100644 index 0000000..102194d --- /dev/null +++ b/docs/models/sdkerrors/enablepapertraillogerrors.md @@ -0,0 +1,10 @@ +# EnablePaperTrailLogErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/enablepapertraillogresponsebody.md b/docs/models/sdkerrors/enablepapertraillogresponsebody.md new file mode 100644 index 0000000..e4695e5 --- /dev/null +++ b/docs/models/sdkerrors/enablepapertraillogresponsebody.md @@ -0,0 +1,11 @@ +# EnablePaperTrailLogResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.EnablePaperTrailLogErrors](../../models/sdkerrors/enablepapertraillogerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/enablepapertrailresponsebody.md b/docs/models/sdkerrors/enablepapertrailresponsebody.md index 4d21e7b..2e462c0 100644 --- a/docs/models/sdkerrors/enablepapertrailresponsebody.md +++ b/docs/models/sdkerrors/enablepapertrailresponsebody.md @@ -1,6 +1,6 @@ # EnablePaperTrailResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/errors.md b/docs/models/sdkerrors/errors.md index ccc4d42..26b5b3e 100644 --- a/docs/models/sdkerrors/errors.md +++ b/docs/models/sdkerrors/errors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getalllibrarieserrors.md b/docs/models/sdkerrors/getalllibrarieserrors.md new file mode 100644 index 0000000..a7da551 --- /dev/null +++ b/docs/models/sdkerrors/getalllibrarieserrors.md @@ -0,0 +1,10 @@ +# GetAllLibrariesErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getalllibrarieslibraryerrors.md b/docs/models/sdkerrors/getalllibrarieslibraryerrors.md new file mode 100644 index 0000000..d6fb0d6 --- /dev/null +++ b/docs/models/sdkerrors/getalllibrarieslibraryerrors.md @@ -0,0 +1,10 @@ +# GetAllLibrariesLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getalllibrarieslibraryresponsebody.md b/docs/models/sdkerrors/getalllibrarieslibraryresponsebody.md new file mode 100644 index 0000000..f21b071 --- /dev/null +++ b/docs/models/sdkerrors/getalllibrarieslibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetAllLibrariesLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetAllLibrariesLibraryErrors](../../models/sdkerrors/getalllibrarieslibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getalllibrariesresponsebody.md b/docs/models/sdkerrors/getalllibrariesresponsebody.md new file mode 100644 index 0000000..b206a7c --- /dev/null +++ b/docs/models/sdkerrors/getalllibrariesresponsebody.md @@ -0,0 +1,11 @@ +# GetAllLibrariesResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetAllLibrariesErrors](../../models/sdkerrors/getalllibrarieserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getavailableclientserrors.md b/docs/models/sdkerrors/getavailableclientserrors.md index 0bfbee3..083a3fe 100644 --- a/docs/models/sdkerrors/getavailableclientserrors.md +++ b/docs/models/sdkerrors/getavailableclientserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getavailableclientsresponsebody.md b/docs/models/sdkerrors/getavailableclientsresponsebody.md index 9876384..fc28f21 100644 --- a/docs/models/sdkerrors/getavailableclientsresponsebody.md +++ b/docs/models/sdkerrors/getavailableclientsresponsebody.md @@ -1,6 +1,6 @@ # GetAvailableClientsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getavailableclientsservererrors.md b/docs/models/sdkerrors/getavailableclientsservererrors.md new file mode 100644 index 0000000..16ba1f5 --- /dev/null +++ b/docs/models/sdkerrors/getavailableclientsservererrors.md @@ -0,0 +1,10 @@ +# GetAvailableClientsServerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getavailableclientsserverresponsebody.md b/docs/models/sdkerrors/getavailableclientsserverresponsebody.md new file mode 100644 index 0000000..da34568 --- /dev/null +++ b/docs/models/sdkerrors/getavailableclientsserverresponsebody.md @@ -0,0 +1,11 @@ +# GetAvailableClientsServerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetAvailableClientsServerErrors](../../models/sdkerrors/getavailableclientsservererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbandwidthstatisticserrors.md b/docs/models/sdkerrors/getbandwidthstatisticserrors.md index dafd0e2..9354ca7 100644 --- a/docs/models/sdkerrors/getbandwidthstatisticserrors.md +++ b/docs/models/sdkerrors/getbandwidthstatisticserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbandwidthstatisticsresponsebody.md b/docs/models/sdkerrors/getbandwidthstatisticsresponsebody.md index 8e7f30a..db32c15 100644 --- a/docs/models/sdkerrors/getbandwidthstatisticsresponsebody.md +++ b/docs/models/sdkerrors/getbandwidthstatisticsresponsebody.md @@ -1,6 +1,6 @@ # GetBandwidthStatisticsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getbandwidthstatisticsstatisticserrors.md b/docs/models/sdkerrors/getbandwidthstatisticsstatisticserrors.md new file mode 100644 index 0000000..cd83f27 --- /dev/null +++ b/docs/models/sdkerrors/getbandwidthstatisticsstatisticserrors.md @@ -0,0 +1,10 @@ +# GetBandwidthStatisticsStatisticsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbandwidthstatisticsstatisticsresponsebody.md b/docs/models/sdkerrors/getbandwidthstatisticsstatisticsresponsebody.md new file mode 100644 index 0000000..3dd24f7 --- /dev/null +++ b/docs/models/sdkerrors/getbandwidthstatisticsstatisticsresponsebody.md @@ -0,0 +1,11 @@ +# GetBandwidthStatisticsStatisticsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetBandwidthStatisticsStatisticsErrors](../../models/sdkerrors/getbandwidthstatisticsstatisticserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbannerimageerrors.md b/docs/models/sdkerrors/getbannerimageerrors.md new file mode 100644 index 0000000..de0aa56 --- /dev/null +++ b/docs/models/sdkerrors/getbannerimageerrors.md @@ -0,0 +1,10 @@ +# GetBannerImageErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbannerimagemediaerrors.md b/docs/models/sdkerrors/getbannerimagemediaerrors.md new file mode 100644 index 0000000..5e45507 --- /dev/null +++ b/docs/models/sdkerrors/getbannerimagemediaerrors.md @@ -0,0 +1,10 @@ +# GetBannerImageMediaErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbannerimagemediaresponsebody.md b/docs/models/sdkerrors/getbannerimagemediaresponsebody.md new file mode 100644 index 0000000..05eb20e --- /dev/null +++ b/docs/models/sdkerrors/getbannerimagemediaresponsebody.md @@ -0,0 +1,11 @@ +# GetBannerImageMediaResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetBannerImageMediaErrors](../../models/sdkerrors/getbannerimagemediaerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbannerimageresponsebody.md b/docs/models/sdkerrors/getbannerimageresponsebody.md new file mode 100644 index 0000000..7a93cdf --- /dev/null +++ b/docs/models/sdkerrors/getbannerimageresponsebody.md @@ -0,0 +1,11 @@ +# GetBannerImageResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetBannerImageErrors](../../models/sdkerrors/getbannerimageerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbutlertasksbutlererrors.md b/docs/models/sdkerrors/getbutlertasksbutlererrors.md new file mode 100644 index 0000000..6f13b56 --- /dev/null +++ b/docs/models/sdkerrors/getbutlertasksbutlererrors.md @@ -0,0 +1,10 @@ +# GetButlerTasksButlerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbutlertasksbutlerresponsebody.md b/docs/models/sdkerrors/getbutlertasksbutlerresponsebody.md new file mode 100644 index 0000000..11db33f --- /dev/null +++ b/docs/models/sdkerrors/getbutlertasksbutlerresponsebody.md @@ -0,0 +1,11 @@ +# GetButlerTasksButlerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetButlerTasksButlerErrors](../../models/sdkerrors/getbutlertasksbutlererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbutlertaskserrors.md b/docs/models/sdkerrors/getbutlertaskserrors.md index 095b651..50697ba 100644 --- a/docs/models/sdkerrors/getbutlertaskserrors.md +++ b/docs/models/sdkerrors/getbutlertaskserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getbutlertasksresponsebody.md b/docs/models/sdkerrors/getbutlertasksresponsebody.md index 2889afe..e511d6f 100644 --- a/docs/models/sdkerrors/getbutlertasksresponsebody.md +++ b/docs/models/sdkerrors/getbutlertasksresponsebody.md @@ -1,6 +1,6 @@ # GetButlerTasksResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getcompanionsdataerrors.md b/docs/models/sdkerrors/getcompanionsdataerrors.md new file mode 100644 index 0000000..0e09d66 --- /dev/null +++ b/docs/models/sdkerrors/getcompanionsdataerrors.md @@ -0,0 +1,10 @@ +# GetCompanionsDataErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getcompanionsdataplexerrors.md b/docs/models/sdkerrors/getcompanionsdataplexerrors.md new file mode 100644 index 0000000..c14f6fa --- /dev/null +++ b/docs/models/sdkerrors/getcompanionsdataplexerrors.md @@ -0,0 +1,10 @@ +# GetCompanionsDataPlexErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getcompanionsdataplexresponsebody.md b/docs/models/sdkerrors/getcompanionsdataplexresponsebody.md new file mode 100644 index 0000000..a3a7579 --- /dev/null +++ b/docs/models/sdkerrors/getcompanionsdataplexresponsebody.md @@ -0,0 +1,11 @@ +# GetCompanionsDataPlexResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetCompanionsDataPlexErrors](../../models/sdkerrors/getcompanionsdataplexerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getcompanionsdataresponsebody.md b/docs/models/sdkerrors/getcompanionsdataresponsebody.md new file mode 100644 index 0000000..45db9c0 --- /dev/null +++ b/docs/models/sdkerrors/getcompanionsdataresponsebody.md @@ -0,0 +1,11 @@ +# GetCompanionsDataResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetCompanionsDataErrors](../../models/sdkerrors/getcompanionsdataerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getdeviceserrors.md b/docs/models/sdkerrors/getdeviceserrors.md index 39444d1..ce81b0a 100644 --- a/docs/models/sdkerrors/getdeviceserrors.md +++ b/docs/models/sdkerrors/getdeviceserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getdevicesresponsebody.md b/docs/models/sdkerrors/getdevicesresponsebody.md index b633bd3..41acf63 100644 --- a/docs/models/sdkerrors/getdevicesresponsebody.md +++ b/docs/models/sdkerrors/getdevicesresponsebody.md @@ -1,6 +1,6 @@ # GetDevicesResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getdevicesservererrors.md b/docs/models/sdkerrors/getdevicesservererrors.md new file mode 100644 index 0000000..a8c26f7 --- /dev/null +++ b/docs/models/sdkerrors/getdevicesservererrors.md @@ -0,0 +1,10 @@ +# GetDevicesServerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getdevicesserverresponsebody.md b/docs/models/sdkerrors/getdevicesserverresponsebody.md new file mode 100644 index 0000000..7c86b9c --- /dev/null +++ b/docs/models/sdkerrors/getdevicesserverresponsebody.md @@ -0,0 +1,11 @@ +# GetDevicesServerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetDevicesServerErrors](../../models/sdkerrors/getdevicesservererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getfilehasherrors.md b/docs/models/sdkerrors/getfilehasherrors.md index 26561a0..b24bac1 100644 --- a/docs/models/sdkerrors/getfilehasherrors.md +++ b/docs/models/sdkerrors/getfilehasherrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getfilehashlibraryerrors.md b/docs/models/sdkerrors/getfilehashlibraryerrors.md new file mode 100644 index 0000000..6c71a72 --- /dev/null +++ b/docs/models/sdkerrors/getfilehashlibraryerrors.md @@ -0,0 +1,10 @@ +# GetFileHashLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getfilehashlibraryresponsebody.md b/docs/models/sdkerrors/getfilehashlibraryresponsebody.md new file mode 100644 index 0000000..1da4e5c --- /dev/null +++ b/docs/models/sdkerrors/getfilehashlibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetFileHashLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetFileHashLibraryErrors](../../models/sdkerrors/getfilehashlibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getfilehashresponsebody.md b/docs/models/sdkerrors/getfilehashresponsebody.md index e865f2d..f536f8e 100644 --- a/docs/models/sdkerrors/getfilehashresponsebody.md +++ b/docs/models/sdkerrors/getfilehashresponsebody.md @@ -1,6 +1,6 @@ # GetFileHashResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/gettokenerrors.md b/docs/models/sdkerrors/getgeodataerrors.md similarity index 85% rename from docs/models/sdkerrors/gettokenerrors.md rename to docs/models/sdkerrors/getgeodataerrors.md index 8e8419c..91d680e 100644 --- a/docs/models/sdkerrors/gettokenerrors.md +++ b/docs/models/sdkerrors/getgeodataerrors.md @@ -1,10 +1,10 @@ -# GetTokenErrors +# GetGeoDataErrors ## Fields | Field | Type | Required | Description | Example | | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1000 | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | | `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibrarieserrors.md b/docs/models/sdkerrors/getgeodataplexerrors.md similarity index 83% rename from docs/models/sdkerrors/getlibrarieserrors.md rename to docs/models/sdkerrors/getgeodataplexerrors.md index 2c63951..4068e01 100644 --- a/docs/models/sdkerrors/getlibrarieserrors.md +++ b/docs/models/sdkerrors/getgeodataplexerrors.md @@ -1,10 +1,10 @@ -# GetLibrariesErrors +# GetGeoDataPlexErrors ## Fields | Field | Type | Required | Description | Example | | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | | `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/refreshlibraryresponsebody.md b/docs/models/sdkerrors/getgeodataplexresponsebody.md similarity index 89% rename from docs/models/sdkerrors/refreshlibraryresponsebody.md rename to docs/models/sdkerrors/getgeodataplexresponsebody.md index 2a52552..04c949f 100644 --- a/docs/models/sdkerrors/refreshlibraryresponsebody.md +++ b/docs/models/sdkerrors/getgeodataplexresponsebody.md @@ -1,4 +1,4 @@ -# RefreshLibraryResponseBody +# GetGeoDataPlexResponseBody Unauthorized - Returned if the X-Plex-Token is missing from the header or query. @@ -7,5 +7,5 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. | Field | Type | Required | Description | | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -| `Errors` | [][sdkerrors.RefreshLibraryErrors](../../models/sdkerrors/refreshlibraryerrors.md) | :heavy_minus_sign: | N/A | +| `Errors` | [][sdkerrors.GetGeoDataPlexErrors](../../models/sdkerrors/getgeodataplexerrors.md) | :heavy_minus_sign: | N/A | | `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getgeodataresponsebody.md b/docs/models/sdkerrors/getgeodataresponsebody.md new file mode 100644 index 0000000..be38d53 --- /dev/null +++ b/docs/models/sdkerrors/getgeodataresponsebody.md @@ -0,0 +1,11 @@ +# GetGeoDataResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetGeoDataErrors](../../models/sdkerrors/getgeodataerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getglobalhubserrors.md b/docs/models/sdkerrors/getglobalhubserrors.md index 8f3fe21..3bb7307 100644 --- a/docs/models/sdkerrors/getglobalhubserrors.md +++ b/docs/models/sdkerrors/getglobalhubserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserveridentityerrors.md b/docs/models/sdkerrors/getglobalhubshubserrors.md similarity index 82% rename from docs/models/sdkerrors/getserveridentityerrors.md rename to docs/models/sdkerrors/getglobalhubshubserrors.md index d464d18..697f538 100644 --- a/docs/models/sdkerrors/getserveridentityerrors.md +++ b/docs/models/sdkerrors/getglobalhubshubserrors.md @@ -1,10 +1,10 @@ -# GetServerIdentityErrors +# GetGlobalHubsHubsErrors ## Fields | Field | Type | Required | Description | Example | | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | | `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getglobalhubshubsresponsebody.md b/docs/models/sdkerrors/getglobalhubshubsresponsebody.md new file mode 100644 index 0000000..227e39a --- /dev/null +++ b/docs/models/sdkerrors/getglobalhubshubsresponsebody.md @@ -0,0 +1,11 @@ +# GetGlobalHubsHubsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetGlobalHubsHubsErrors](../../models/sdkerrors/getglobalhubshubserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getglobalhubsresponsebody.md b/docs/models/sdkerrors/getglobalhubsresponsebody.md index 9f5c172..ea0f472 100644 --- a/docs/models/sdkerrors/getglobalhubsresponsebody.md +++ b/docs/models/sdkerrors/getglobalhubsresponsebody.md @@ -1,6 +1,6 @@ # GetGlobalHubsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/gethomedataerrors.md b/docs/models/sdkerrors/gethomedataerrors.md index 70a5551..93f6048 100644 --- a/docs/models/sdkerrors/gethomedataerrors.md +++ b/docs/models/sdkerrors/gethomedataerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/refreshlibraryerrors.md b/docs/models/sdkerrors/gethomedataplexerrors.md similarity index 83% rename from docs/models/sdkerrors/refreshlibraryerrors.md rename to docs/models/sdkerrors/gethomedataplexerrors.md index a9948b9..a7d4476 100644 --- a/docs/models/sdkerrors/refreshlibraryerrors.md +++ b/docs/models/sdkerrors/gethomedataplexerrors.md @@ -1,10 +1,10 @@ -# RefreshLibraryErrors +# GetHomeDataPlexErrors ## Fields | Field | Type | Required | Description | Example | | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | | `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/gethomedataplexresponsebody.md b/docs/models/sdkerrors/gethomedataplexresponsebody.md new file mode 100644 index 0000000..f749678 --- /dev/null +++ b/docs/models/sdkerrors/gethomedataplexresponsebody.md @@ -0,0 +1,11 @@ +# GetHomeDataPlexResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetHomeDataPlexErrors](../../models/sdkerrors/gethomedataplexerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/gethomedataresponsebody.md b/docs/models/sdkerrors/gethomedataresponsebody.md index 1315c08..2700f83 100644 --- a/docs/models/sdkerrors/gethomedataresponsebody.md +++ b/docs/models/sdkerrors/gethomedataresponsebody.md @@ -1,6 +1,6 @@ # GetHomeDataResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getlibrariesresponsebody.md b/docs/models/sdkerrors/getlibrariesresponsebody.md deleted file mode 100644 index 510bdd5..0000000 --- a/docs/models/sdkerrors/getlibrariesresponsebody.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetLibrariesResponseBody - -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - - -## Fields - -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `Errors` | [][sdkerrors.GetLibrariesErrors](../../models/sdkerrors/getlibrarieserrors.md) | :heavy_minus_sign: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibrarydetailserrors.md b/docs/models/sdkerrors/getlibrarydetailserrors.md new file mode 100644 index 0000000..c9a6894 --- /dev/null +++ b/docs/models/sdkerrors/getlibrarydetailserrors.md @@ -0,0 +1,10 @@ +# GetLibraryDetailsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibrarydetailslibraryerrors.md b/docs/models/sdkerrors/getlibrarydetailslibraryerrors.md new file mode 100644 index 0000000..a45ae5d --- /dev/null +++ b/docs/models/sdkerrors/getlibrarydetailslibraryerrors.md @@ -0,0 +1,10 @@ +# GetLibraryDetailsLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibrarydetailslibraryresponsebody.md b/docs/models/sdkerrors/getlibrarydetailslibraryresponsebody.md new file mode 100644 index 0000000..2785478 --- /dev/null +++ b/docs/models/sdkerrors/getlibrarydetailslibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetLibraryDetailsLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetLibraryDetailsLibraryErrors](../../models/sdkerrors/getlibrarydetailslibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibrarydetailsresponsebody.md b/docs/models/sdkerrors/getlibrarydetailsresponsebody.md new file mode 100644 index 0000000..9ace686 --- /dev/null +++ b/docs/models/sdkerrors/getlibrarydetailsresponsebody.md @@ -0,0 +1,11 @@ +# GetLibraryDetailsResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetLibraryDetailsErrors](../../models/sdkerrors/getlibrarydetailserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibraryhubserrors.md b/docs/models/sdkerrors/getlibraryhubserrors.md index af9cd79..059bdb0 100644 --- a/docs/models/sdkerrors/getlibraryhubserrors.md +++ b/docs/models/sdkerrors/getlibraryhubserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibraryhubshubserrors.md b/docs/models/sdkerrors/getlibraryhubshubserrors.md new file mode 100644 index 0000000..e76b107 --- /dev/null +++ b/docs/models/sdkerrors/getlibraryhubshubserrors.md @@ -0,0 +1,10 @@ +# GetLibraryHubsHubsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibraryhubshubsresponsebody.md b/docs/models/sdkerrors/getlibraryhubshubsresponsebody.md new file mode 100644 index 0000000..6860373 --- /dev/null +++ b/docs/models/sdkerrors/getlibraryhubshubsresponsebody.md @@ -0,0 +1,11 @@ +# GetLibraryHubsHubsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetLibraryHubsHubsErrors](../../models/sdkerrors/getlibraryhubshubserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibraryhubsresponsebody.md b/docs/models/sdkerrors/getlibraryhubsresponsebody.md index 464ab2c..4c4608d 100644 --- a/docs/models/sdkerrors/getlibraryhubsresponsebody.md +++ b/docs/models/sdkerrors/getlibraryhubsresponsebody.md @@ -1,6 +1,6 @@ # GetLibraryHubsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getlibraryitemserrors.md b/docs/models/sdkerrors/getlibraryitemserrors.md index 21428b6..d23b87d 100644 --- a/docs/models/sdkerrors/getlibraryitemserrors.md +++ b/docs/models/sdkerrors/getlibraryitemserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibraryitemslibraryerrors.md b/docs/models/sdkerrors/getlibraryitemslibraryerrors.md new file mode 100644 index 0000000..af2f6ad --- /dev/null +++ b/docs/models/sdkerrors/getlibraryitemslibraryerrors.md @@ -0,0 +1,10 @@ +# GetLibraryItemsLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibraryitemslibraryresponsebody.md b/docs/models/sdkerrors/getlibraryitemslibraryresponsebody.md new file mode 100644 index 0000000..8b4fa3d --- /dev/null +++ b/docs/models/sdkerrors/getlibraryitemslibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetLibraryItemsLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetLibraryItemsLibraryErrors](../../models/sdkerrors/getlibraryitemslibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibraryitemsresponsebody.md b/docs/models/sdkerrors/getlibraryitemsresponsebody.md index 292d36b..0a26219 100644 --- a/docs/models/sdkerrors/getlibraryitemsresponsebody.md +++ b/docs/models/sdkerrors/getlibraryitemsresponsebody.md @@ -1,6 +1,6 @@ # GetLibraryItemsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getmediaproviderserrors.md b/docs/models/sdkerrors/getmediaproviderserrors.md new file mode 100644 index 0000000..4f0cea0 --- /dev/null +++ b/docs/models/sdkerrors/getmediaproviderserrors.md @@ -0,0 +1,10 @@ +# GetMediaProvidersErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmediaprovidersresponsebody.md b/docs/models/sdkerrors/getmediaprovidersresponsebody.md new file mode 100644 index 0000000..9409ebc --- /dev/null +++ b/docs/models/sdkerrors/getmediaprovidersresponsebody.md @@ -0,0 +1,11 @@ +# GetMediaProvidersResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetMediaProvidersErrors](../../models/sdkerrors/getmediaproviderserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmediaprovidersservererrors.md b/docs/models/sdkerrors/getmediaprovidersservererrors.md new file mode 100644 index 0000000..4559aa8 --- /dev/null +++ b/docs/models/sdkerrors/getmediaprovidersservererrors.md @@ -0,0 +1,10 @@ +# GetMediaProvidersServerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmediaprovidersserverresponsebody.md b/docs/models/sdkerrors/getmediaprovidersserverresponsebody.md new file mode 100644 index 0000000..e08d67c --- /dev/null +++ b/docs/models/sdkerrors/getmediaprovidersserverresponsebody.md @@ -0,0 +1,11 @@ +# GetMediaProvidersServerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetMediaProvidersServerErrors](../../models/sdkerrors/getmediaprovidersservererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmetadatabyratingkeyerrors.md b/docs/models/sdkerrors/getmetadatabyratingkeyerrors.md new file mode 100644 index 0000000..f078760 --- /dev/null +++ b/docs/models/sdkerrors/getmetadatabyratingkeyerrors.md @@ -0,0 +1,10 @@ +# GetMetaDataByRatingKeyErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmetadatabyratingkeylibraryerrors.md b/docs/models/sdkerrors/getmetadatabyratingkeylibraryerrors.md new file mode 100644 index 0000000..610b35a --- /dev/null +++ b/docs/models/sdkerrors/getmetadatabyratingkeylibraryerrors.md @@ -0,0 +1,10 @@ +# GetMetaDataByRatingKeyLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmetadatabyratingkeylibraryresponsebody.md b/docs/models/sdkerrors/getmetadatabyratingkeylibraryresponsebody.md new file mode 100644 index 0000000..8928749 --- /dev/null +++ b/docs/models/sdkerrors/getmetadatabyratingkeylibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetMetaDataByRatingKeyLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetMetaDataByRatingKeyLibraryErrors](../../models/sdkerrors/getmetadatabyratingkeylibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmetadatabyratingkeyresponsebody.md b/docs/models/sdkerrors/getmetadatabyratingkeyresponsebody.md new file mode 100644 index 0000000..dba9a33 --- /dev/null +++ b/docs/models/sdkerrors/getmetadatabyratingkeyresponsebody.md @@ -0,0 +1,11 @@ +# GetMetaDataByRatingKeyResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetMetaDataByRatingKeyErrors](../../models/sdkerrors/getmetadatabyratingkeyerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmetadatachildrenerrors.md b/docs/models/sdkerrors/getmetadatachildrenerrors.md index ef2be3a..fa32238 100644 --- a/docs/models/sdkerrors/getmetadatachildrenerrors.md +++ b/docs/models/sdkerrors/getmetadatachildrenerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmetadatachildrenlibraryerrors.md b/docs/models/sdkerrors/getmetadatachildrenlibraryerrors.md new file mode 100644 index 0000000..b8e3f74 --- /dev/null +++ b/docs/models/sdkerrors/getmetadatachildrenlibraryerrors.md @@ -0,0 +1,10 @@ +# GetMetadataChildrenLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmetadatachildrenlibraryresponsebody.md b/docs/models/sdkerrors/getmetadatachildrenlibraryresponsebody.md new file mode 100644 index 0000000..b140fb8 --- /dev/null +++ b/docs/models/sdkerrors/getmetadatachildrenlibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetMetadataChildrenLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetMetadataChildrenLibraryErrors](../../models/sdkerrors/getmetadatachildrenlibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmetadatachildrenresponsebody.md b/docs/models/sdkerrors/getmetadatachildrenresponsebody.md index 298ded2..c002f6f 100644 --- a/docs/models/sdkerrors/getmetadatachildrenresponsebody.md +++ b/docs/models/sdkerrors/getmetadatachildrenresponsebody.md @@ -1,6 +1,6 @@ # GetMetadataChildrenResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getmetadataresponsebody.md b/docs/models/sdkerrors/getmetadataresponsebody.md deleted file mode 100644 index 375d3c9..0000000 --- a/docs/models/sdkerrors/getmetadataresponsebody.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetMetadataResponseBody - -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| `Errors` | [][sdkerrors.GetMetadataErrors](../../models/sdkerrors/getmetadataerrors.md) | :heavy_minus_sign: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmyplexaccounterrors.md b/docs/models/sdkerrors/getmyplexaccounterrors.md index 569c34c..2ad670a 100644 --- a/docs/models/sdkerrors/getmyplexaccounterrors.md +++ b/docs/models/sdkerrors/getmyplexaccounterrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmyplexaccountresponsebody.md b/docs/models/sdkerrors/getmyplexaccountresponsebody.md index 518c6a9..1ef522a 100644 --- a/docs/models/sdkerrors/getmyplexaccountresponsebody.md +++ b/docs/models/sdkerrors/getmyplexaccountresponsebody.md @@ -1,6 +1,6 @@ # GetMyPlexAccountResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getmyplexaccountservererrors.md b/docs/models/sdkerrors/getmyplexaccountservererrors.md new file mode 100644 index 0000000..285df2d --- /dev/null +++ b/docs/models/sdkerrors/getmyplexaccountservererrors.md @@ -0,0 +1,10 @@ +# GetMyPlexAccountServerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getmyplexaccountserverresponsebody.md b/docs/models/sdkerrors/getmyplexaccountserverresponsebody.md new file mode 100644 index 0000000..e9dc60b --- /dev/null +++ b/docs/models/sdkerrors/getmyplexaccountserverresponsebody.md @@ -0,0 +1,11 @@ +# GetMyPlexAccountServerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetMyPlexAccountServerErrors](../../models/sdkerrors/getmyplexaccountservererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getondeckerrors.md b/docs/models/sdkerrors/getondeckerrors.md index 46fc174..d9235ca 100644 --- a/docs/models/sdkerrors/getondeckerrors.md +++ b/docs/models/sdkerrors/getondeckerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getondecklibraryerrors.md b/docs/models/sdkerrors/getondecklibraryerrors.md new file mode 100644 index 0000000..258738c --- /dev/null +++ b/docs/models/sdkerrors/getondecklibraryerrors.md @@ -0,0 +1,10 @@ +# GetOnDeckLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getondecklibraryresponsebody.md b/docs/models/sdkerrors/getondecklibraryresponsebody.md new file mode 100644 index 0000000..de89de6 --- /dev/null +++ b/docs/models/sdkerrors/getondecklibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetOnDeckLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetOnDeckLibraryErrors](../../models/sdkerrors/getondecklibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getondeckresponsebody.md b/docs/models/sdkerrors/getondeckresponsebody.md index 1755c26..2afabd4 100644 --- a/docs/models/sdkerrors/getondeckresponsebody.md +++ b/docs/models/sdkerrors/getondeckresponsebody.md @@ -1,6 +1,6 @@ # GetOnDeckResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getpinerrors.md b/docs/models/sdkerrors/getpinerrors.md index 6e04d08..a5f64e5 100644 --- a/docs/models/sdkerrors/getpinerrors.md +++ b/docs/models/sdkerrors/getpinerrors.md @@ -5,6 +5,6 @@ | Field | Type | Required | Description | Example | | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1000 | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | | `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getpinresponsebody.md b/docs/models/sdkerrors/getpinresponsebody.md index 88b93bc..6852a6e 100644 --- a/docs/models/sdkerrors/getpinresponsebody.md +++ b/docs/models/sdkerrors/getpinresponsebody.md @@ -1,6 +1,6 @@ # GetPinResponseBody -X-Plex-Client-Identifier is missing +Bad Request response when the X-Plex-Client-Identifier is missing ## Fields diff --git a/docs/models/sdkerrors/getplaylistcontentserrors.md b/docs/models/sdkerrors/getplaylistcontentserrors.md index 154a798..7c9b671 100644 --- a/docs/models/sdkerrors/getplaylistcontentserrors.md +++ b/docs/models/sdkerrors/getplaylistcontentserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getplaylistcontentsplaylistserrors.md b/docs/models/sdkerrors/getplaylistcontentsplaylistserrors.md new file mode 100644 index 0000000..c829530 --- /dev/null +++ b/docs/models/sdkerrors/getplaylistcontentsplaylistserrors.md @@ -0,0 +1,10 @@ +# GetPlaylistContentsPlaylistsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getplaylistcontentsplaylistsresponsebody.md b/docs/models/sdkerrors/getplaylistcontentsplaylistsresponsebody.md new file mode 100644 index 0000000..2aeb6e8 --- /dev/null +++ b/docs/models/sdkerrors/getplaylistcontentsplaylistsresponsebody.md @@ -0,0 +1,11 @@ +# GetPlaylistContentsPlaylistsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetPlaylistContentsPlaylistsErrors](../../models/sdkerrors/getplaylistcontentsplaylistserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getplaylistcontentsresponsebody.md b/docs/models/sdkerrors/getplaylistcontentsresponsebody.md index d96ede8..8655e3b 100644 --- a/docs/models/sdkerrors/getplaylistcontentsresponsebody.md +++ b/docs/models/sdkerrors/getplaylistcontentsresponsebody.md @@ -1,6 +1,6 @@ # GetPlaylistContentsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getplaylisterrors.md b/docs/models/sdkerrors/getplaylisterrors.md index e6da41c..d506de6 100644 --- a/docs/models/sdkerrors/getplaylisterrors.md +++ b/docs/models/sdkerrors/getplaylisterrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getplaylistplaylistserrors.md b/docs/models/sdkerrors/getplaylistplaylistserrors.md new file mode 100644 index 0000000..5bafb01 --- /dev/null +++ b/docs/models/sdkerrors/getplaylistplaylistserrors.md @@ -0,0 +1,10 @@ +# GetPlaylistPlaylistsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getplaylistplaylistsresponsebody.md b/docs/models/sdkerrors/getplaylistplaylistsresponsebody.md new file mode 100644 index 0000000..c3c5d32 --- /dev/null +++ b/docs/models/sdkerrors/getplaylistplaylistsresponsebody.md @@ -0,0 +1,11 @@ +# GetPlaylistPlaylistsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetPlaylistPlaylistsErrors](../../models/sdkerrors/getplaylistplaylistserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getplaylistresponsebody.md b/docs/models/sdkerrors/getplaylistresponsebody.md index cde9b0c..44ffb82 100644 --- a/docs/models/sdkerrors/getplaylistresponsebody.md +++ b/docs/models/sdkerrors/getplaylistresponsebody.md @@ -1,6 +1,6 @@ # GetPlaylistResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getplaylistserrors.md b/docs/models/sdkerrors/getplaylistserrors.md index d60cc1c..0bc556e 100644 --- a/docs/models/sdkerrors/getplaylistserrors.md +++ b/docs/models/sdkerrors/getplaylistserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getplaylistsplaylistserrors.md b/docs/models/sdkerrors/getplaylistsplaylistserrors.md new file mode 100644 index 0000000..6d89ae7 --- /dev/null +++ b/docs/models/sdkerrors/getplaylistsplaylistserrors.md @@ -0,0 +1,10 @@ +# GetPlaylistsPlaylistsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getplaylistsplaylistsresponsebody.md b/docs/models/sdkerrors/getplaylistsplaylistsresponsebody.md new file mode 100644 index 0000000..ff2ee58 --- /dev/null +++ b/docs/models/sdkerrors/getplaylistsplaylistsresponsebody.md @@ -0,0 +1,11 @@ +# GetPlaylistsPlaylistsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetPlaylistsPlaylistsErrors](../../models/sdkerrors/getplaylistsplaylistserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getplaylistsresponsebody.md b/docs/models/sdkerrors/getplaylistsresponsebody.md index 8a04444..08dfe0c 100644 --- a/docs/models/sdkerrors/getplaylistsresponsebody.md +++ b/docs/models/sdkerrors/getplaylistsresponsebody.md @@ -1,6 +1,6 @@ # GetPlaylistsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getrecentlyaddederrors.md b/docs/models/sdkerrors/getrecentlyaddederrors.md index 13dddec..21fe657 100644 --- a/docs/models/sdkerrors/getrecentlyaddederrors.md +++ b/docs/models/sdkerrors/getrecentlyaddederrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getrecentlyaddedlibraryerrors.md b/docs/models/sdkerrors/getrecentlyaddedlibraryerrors.md new file mode 100644 index 0000000..972566a --- /dev/null +++ b/docs/models/sdkerrors/getrecentlyaddedlibraryerrors.md @@ -0,0 +1,10 @@ +# GetRecentlyAddedLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getrecentlyaddedlibraryresponsebody.md b/docs/models/sdkerrors/getrecentlyaddedlibraryresponsebody.md new file mode 100644 index 0000000..b2ca14e --- /dev/null +++ b/docs/models/sdkerrors/getrecentlyaddedlibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetRecentlyAddedLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetRecentlyAddedLibraryErrors](../../models/sdkerrors/getrecentlyaddedlibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getrecentlyaddedresponsebody.md b/docs/models/sdkerrors/getrecentlyaddedresponsebody.md index aa93aa9..5cb6be1 100644 --- a/docs/models/sdkerrors/getrecentlyaddedresponsebody.md +++ b/docs/models/sdkerrors/getrecentlyaddedresponsebody.md @@ -1,6 +1,6 @@ # GetRecentlyAddedResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getrefreshlibrarymetadataerrors.md b/docs/models/sdkerrors/getrefreshlibrarymetadataerrors.md new file mode 100644 index 0000000..c51d4d7 --- /dev/null +++ b/docs/models/sdkerrors/getrefreshlibrarymetadataerrors.md @@ -0,0 +1,10 @@ +# GetRefreshLibraryMetadataErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getrefreshlibrarymetadatalibraryerrors.md b/docs/models/sdkerrors/getrefreshlibrarymetadatalibraryerrors.md new file mode 100644 index 0000000..15ba707 --- /dev/null +++ b/docs/models/sdkerrors/getrefreshlibrarymetadatalibraryerrors.md @@ -0,0 +1,10 @@ +# GetRefreshLibraryMetadataLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getrefreshlibrarymetadatalibraryresponsebody.md b/docs/models/sdkerrors/getrefreshlibrarymetadatalibraryresponsebody.md new file mode 100644 index 0000000..8985ea0 --- /dev/null +++ b/docs/models/sdkerrors/getrefreshlibrarymetadatalibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetRefreshLibraryMetadataLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetRefreshLibraryMetadataLibraryErrors](../../models/sdkerrors/getrefreshlibrarymetadatalibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getrefreshlibrarymetadataresponsebody.md b/docs/models/sdkerrors/getrefreshlibrarymetadataresponsebody.md new file mode 100644 index 0000000..5b28f7a --- /dev/null +++ b/docs/models/sdkerrors/getrefreshlibrarymetadataresponsebody.md @@ -0,0 +1,11 @@ +# GetRefreshLibraryMetadataResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetRefreshLibraryMetadataErrors](../../models/sdkerrors/getrefreshlibrarymetadataerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getresizedphotoerrors.md b/docs/models/sdkerrors/getresizedphotoerrors.md index e992723..95f22f6 100644 --- a/docs/models/sdkerrors/getresizedphotoerrors.md +++ b/docs/models/sdkerrors/getresizedphotoerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getresizedphotoresponsebody.md b/docs/models/sdkerrors/getresizedphotoresponsebody.md index 689504b..8567265 100644 --- a/docs/models/sdkerrors/getresizedphotoresponsebody.md +++ b/docs/models/sdkerrors/getresizedphotoresponsebody.md @@ -1,6 +1,6 @@ # GetResizedPhotoResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getresizedphotoservererrors.md b/docs/models/sdkerrors/getresizedphotoservererrors.md new file mode 100644 index 0000000..26d5af9 --- /dev/null +++ b/docs/models/sdkerrors/getresizedphotoservererrors.md @@ -0,0 +1,10 @@ +# GetResizedPhotoServerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getresizedphotoserverresponsebody.md b/docs/models/sdkerrors/getresizedphotoserverresponsebody.md new file mode 100644 index 0000000..1b90533 --- /dev/null +++ b/docs/models/sdkerrors/getresizedphotoserverresponsebody.md @@ -0,0 +1,11 @@ +# GetResizedPhotoServerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetResizedPhotoServerErrors](../../models/sdkerrors/getresizedphotoservererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getresourcesstatisticserrors.md b/docs/models/sdkerrors/getresourcesstatisticserrors.md index 56aad74..20bce42 100644 --- a/docs/models/sdkerrors/getresourcesstatisticserrors.md +++ b/docs/models/sdkerrors/getresourcesstatisticserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getresourcesstatisticsresponsebody.md b/docs/models/sdkerrors/getresourcesstatisticsresponsebody.md index 53068b0..3894f44 100644 --- a/docs/models/sdkerrors/getresourcesstatisticsresponsebody.md +++ b/docs/models/sdkerrors/getresourcesstatisticsresponsebody.md @@ -1,6 +1,6 @@ # GetResourcesStatisticsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getresourcesstatisticsstatisticserrors.md b/docs/models/sdkerrors/getresourcesstatisticsstatisticserrors.md new file mode 100644 index 0000000..39b805f --- /dev/null +++ b/docs/models/sdkerrors/getresourcesstatisticsstatisticserrors.md @@ -0,0 +1,10 @@ +# GetResourcesStatisticsStatisticsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getresourcesstatisticsstatisticsresponsebody.md b/docs/models/sdkerrors/getresourcesstatisticsstatisticsresponsebody.md new file mode 100644 index 0000000..7291934 --- /dev/null +++ b/docs/models/sdkerrors/getresourcesstatisticsstatisticsresponsebody.md @@ -0,0 +1,11 @@ +# GetResourcesStatisticsStatisticsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetResourcesStatisticsStatisticsErrors](../../models/sdkerrors/getresourcesstatisticsstatisticserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsearchlibraryerrors.md b/docs/models/sdkerrors/getsearchlibraryerrors.md new file mode 100644 index 0000000..e1cfd2f --- /dev/null +++ b/docs/models/sdkerrors/getsearchlibraryerrors.md @@ -0,0 +1,10 @@ +# GetSearchLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsearchlibrarylibraryerrors.md b/docs/models/sdkerrors/getsearchlibrarylibraryerrors.md new file mode 100644 index 0000000..8ffa188 --- /dev/null +++ b/docs/models/sdkerrors/getsearchlibrarylibraryerrors.md @@ -0,0 +1,10 @@ +# GetSearchLibraryLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsearchlibrarylibraryresponsebody.md b/docs/models/sdkerrors/getsearchlibrarylibraryresponsebody.md new file mode 100644 index 0000000..80bd4ec --- /dev/null +++ b/docs/models/sdkerrors/getsearchlibrarylibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetSearchLibraryLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetSearchLibraryLibraryErrors](../../models/sdkerrors/getsearchlibrarylibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsearchlibraryresponsebody.md b/docs/models/sdkerrors/getsearchlibraryresponsebody.md new file mode 100644 index 0000000..76312f4 --- /dev/null +++ b/docs/models/sdkerrors/getsearchlibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetSearchLibraryResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetSearchLibraryErrors](../../models/sdkerrors/getsearchlibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsearchresultserrors.md b/docs/models/sdkerrors/getsearchresultserrors.md index 170d6e8..f9a650c 100644 --- a/docs/models/sdkerrors/getsearchresultserrors.md +++ b/docs/models/sdkerrors/getsearchresultserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsearchresultsresponsebody.md b/docs/models/sdkerrors/getsearchresultsresponsebody.md index 9375474..b494095 100644 --- a/docs/models/sdkerrors/getsearchresultsresponsebody.md +++ b/docs/models/sdkerrors/getsearchresultsresponsebody.md @@ -1,6 +1,6 @@ # GetSearchResultsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getsearchresultssearcherrors.md b/docs/models/sdkerrors/getsearchresultssearcherrors.md new file mode 100644 index 0000000..0129705 --- /dev/null +++ b/docs/models/sdkerrors/getsearchresultssearcherrors.md @@ -0,0 +1,10 @@ +# GetSearchResultsSearchErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsearchresultssearchresponsebody.md b/docs/models/sdkerrors/getsearchresultssearchresponsebody.md new file mode 100644 index 0000000..8b2d764 --- /dev/null +++ b/docs/models/sdkerrors/getsearchresultssearchresponsebody.md @@ -0,0 +1,11 @@ +# GetSearchResultsSearchResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetSearchResultsSearchErrors](../../models/sdkerrors/getsearchresultssearcherrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserveractivitiesactivitieserrors.md b/docs/models/sdkerrors/getserveractivitiesactivitieserrors.md new file mode 100644 index 0000000..2e1d30b --- /dev/null +++ b/docs/models/sdkerrors/getserveractivitiesactivitieserrors.md @@ -0,0 +1,10 @@ +# GetServerActivitiesActivitiesErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserveractivitiesactivitiesresponsebody.md b/docs/models/sdkerrors/getserveractivitiesactivitiesresponsebody.md new file mode 100644 index 0000000..f6f1407 --- /dev/null +++ b/docs/models/sdkerrors/getserveractivitiesactivitiesresponsebody.md @@ -0,0 +1,11 @@ +# GetServerActivitiesActivitiesResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetServerActivitiesActivitiesErrors](../../models/sdkerrors/getserveractivitiesactivitieserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserveractivitieserrors.md b/docs/models/sdkerrors/getserveractivitieserrors.md index 7ff91f1..26f4332 100644 --- a/docs/models/sdkerrors/getserveractivitieserrors.md +++ b/docs/models/sdkerrors/getserveractivitieserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserveractivitiesresponsebody.md b/docs/models/sdkerrors/getserveractivitiesresponsebody.md index a8d69ce..5a8bf91 100644 --- a/docs/models/sdkerrors/getserveractivitiesresponsebody.md +++ b/docs/models/sdkerrors/getserveractivitiesresponsebody.md @@ -1,6 +1,6 @@ # GetServerActivitiesResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getservercapabilitieserrors.md b/docs/models/sdkerrors/getservercapabilitieserrors.md new file mode 100644 index 0000000..eb73dab --- /dev/null +++ b/docs/models/sdkerrors/getservercapabilitieserrors.md @@ -0,0 +1,10 @@ +# GetServerCapabilitiesErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getservercapabilitiesresponsebody.md b/docs/models/sdkerrors/getservercapabilitiesresponsebody.md index da5999e..bf435c0 100644 --- a/docs/models/sdkerrors/getservercapabilitiesresponsebody.md +++ b/docs/models/sdkerrors/getservercapabilitiesresponsebody.md @@ -1,6 +1,6 @@ # GetServerCapabilitiesResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getservercapabilitiesserverresponsebody.md b/docs/models/sdkerrors/getservercapabilitiesserverresponsebody.md new file mode 100644 index 0000000..aae7fdd --- /dev/null +++ b/docs/models/sdkerrors/getservercapabilitiesserverresponsebody.md @@ -0,0 +1,11 @@ +# GetServerCapabilitiesServerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetServerCapabilitiesErrors](../../models/sdkerrors/getservercapabilitieserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserveridentityresponsebody.md b/docs/models/sdkerrors/getserveridentityresponsebody.md index 7c8ef7b..9a692e8 100644 --- a/docs/models/sdkerrors/getserveridentityresponsebody.md +++ b/docs/models/sdkerrors/getserveridentityresponsebody.md @@ -1,11 +1,12 @@ # GetServerIdentityResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Request Timeout ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| `Errors` | [][sdkerrors.GetServerIdentityErrors](../../models/sdkerrors/getserveridentityerrors.md) | :heavy_minus_sign: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 408 | +| `Message` | **string* | :heavy_minus_sign: | N/A | The server timed out waiting for the request. | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserverlisterrors.md b/docs/models/sdkerrors/getserverlisterrors.md index 8766c12..c2e847a 100644 --- a/docs/models/sdkerrors/getserverlisterrors.md +++ b/docs/models/sdkerrors/getserverlisterrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserverlistresponsebody.md b/docs/models/sdkerrors/getserverlistresponsebody.md index 76a4a87..d32f623 100644 --- a/docs/models/sdkerrors/getserverlistresponsebody.md +++ b/docs/models/sdkerrors/getserverlistresponsebody.md @@ -1,6 +1,6 @@ # GetServerListResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getserverlistservererrors.md b/docs/models/sdkerrors/getserverlistservererrors.md new file mode 100644 index 0000000..1e87057 --- /dev/null +++ b/docs/models/sdkerrors/getserverlistservererrors.md @@ -0,0 +1,10 @@ +# GetServerListServerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserverlistserverresponsebody.md b/docs/models/sdkerrors/getserverlistserverresponsebody.md new file mode 100644 index 0000000..9016f01 --- /dev/null +++ b/docs/models/sdkerrors/getserverlistserverresponsebody.md @@ -0,0 +1,11 @@ +# GetServerListServerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetServerListServerErrors](../../models/sdkerrors/getserverlistservererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserverpreferenceserrors.md b/docs/models/sdkerrors/getserverpreferenceserrors.md index 182afd2..f628b96 100644 --- a/docs/models/sdkerrors/getserverpreferenceserrors.md +++ b/docs/models/sdkerrors/getserverpreferenceserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserverpreferencesresponsebody.md b/docs/models/sdkerrors/getserverpreferencesresponsebody.md index 51f8887..44b2a78 100644 --- a/docs/models/sdkerrors/getserverpreferencesresponsebody.md +++ b/docs/models/sdkerrors/getserverpreferencesresponsebody.md @@ -1,6 +1,6 @@ # GetServerPreferencesResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getserverpreferencesservererrors.md b/docs/models/sdkerrors/getserverpreferencesservererrors.md new file mode 100644 index 0000000..fd4be34 --- /dev/null +++ b/docs/models/sdkerrors/getserverpreferencesservererrors.md @@ -0,0 +1,10 @@ +# GetServerPreferencesServerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserverpreferencesserverresponsebody.md b/docs/models/sdkerrors/getserverpreferencesserverresponsebody.md new file mode 100644 index 0000000..f797edd --- /dev/null +++ b/docs/models/sdkerrors/getserverpreferencesserverresponsebody.md @@ -0,0 +1,11 @@ +# GetServerPreferencesServerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetServerPreferencesServerErrors](../../models/sdkerrors/getserverpreferencesservererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserverresourceserrors.md b/docs/models/sdkerrors/getserverresourceserrors.md new file mode 100644 index 0000000..9cc9b0c --- /dev/null +++ b/docs/models/sdkerrors/getserverresourceserrors.md @@ -0,0 +1,10 @@ +# GetServerResourcesErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserverresourcesplexerrors.md b/docs/models/sdkerrors/getserverresourcesplexerrors.md new file mode 100644 index 0000000..d6b8fe7 --- /dev/null +++ b/docs/models/sdkerrors/getserverresourcesplexerrors.md @@ -0,0 +1,10 @@ +# GetServerResourcesPlexErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserverresourcesplexresponsebody.md b/docs/models/sdkerrors/getserverresourcesplexresponsebody.md new file mode 100644 index 0000000..e252f18 --- /dev/null +++ b/docs/models/sdkerrors/getserverresourcesplexresponsebody.md @@ -0,0 +1,11 @@ +# GetServerResourcesPlexResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetServerResourcesPlexErrors](../../models/sdkerrors/getserverresourcesplexerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getserverresourcesresponsebody.md b/docs/models/sdkerrors/getserverresourcesresponsebody.md new file mode 100644 index 0000000..63cc662 --- /dev/null +++ b/docs/models/sdkerrors/getserverresourcesresponsebody.md @@ -0,0 +1,11 @@ +# GetServerResourcesResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetServerResourcesErrors](../../models/sdkerrors/getserverresourceserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsessionhistoryerrors.md b/docs/models/sdkerrors/getsessionhistoryerrors.md index e7bc3d9..2ea755a 100644 --- a/docs/models/sdkerrors/getsessionhistoryerrors.md +++ b/docs/models/sdkerrors/getsessionhistoryerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsessionhistoryresponsebody.md b/docs/models/sdkerrors/getsessionhistoryresponsebody.md index a72d6dd..243003c 100644 --- a/docs/models/sdkerrors/getsessionhistoryresponsebody.md +++ b/docs/models/sdkerrors/getsessionhistoryresponsebody.md @@ -1,6 +1,6 @@ # GetSessionHistoryResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getsessionhistorysessionserrors.md b/docs/models/sdkerrors/getsessionhistorysessionserrors.md new file mode 100644 index 0000000..e7a2550 --- /dev/null +++ b/docs/models/sdkerrors/getsessionhistorysessionserrors.md @@ -0,0 +1,10 @@ +# GetSessionHistorySessionsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsessionhistorysessionsresponsebody.md b/docs/models/sdkerrors/getsessionhistorysessionsresponsebody.md new file mode 100644 index 0000000..625d256 --- /dev/null +++ b/docs/models/sdkerrors/getsessionhistorysessionsresponsebody.md @@ -0,0 +1,11 @@ +# GetSessionHistorySessionsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetSessionHistorySessionsErrors](../../models/sdkerrors/getsessionhistorysessionserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsessionserrors.md b/docs/models/sdkerrors/getsessionserrors.md index 351b4c3..fb68a08 100644 --- a/docs/models/sdkerrors/getsessionserrors.md +++ b/docs/models/sdkerrors/getsessionserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsessionsresponsebody.md b/docs/models/sdkerrors/getsessionsresponsebody.md index d7a2679..cfb1792 100644 --- a/docs/models/sdkerrors/getsessionsresponsebody.md +++ b/docs/models/sdkerrors/getsessionsresponsebody.md @@ -1,6 +1,6 @@ # GetSessionsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getsessionssessionserrors.md b/docs/models/sdkerrors/getsessionssessionserrors.md new file mode 100644 index 0000000..bf99a38 --- /dev/null +++ b/docs/models/sdkerrors/getsessionssessionserrors.md @@ -0,0 +1,10 @@ +# GetSessionsSessionsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsessionssessionsresponsebody.md b/docs/models/sdkerrors/getsessionssessionsresponsebody.md new file mode 100644 index 0000000..63f41cc --- /dev/null +++ b/docs/models/sdkerrors/getsessionssessionsresponsebody.md @@ -0,0 +1,11 @@ +# GetSessionsSessionsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetSessionsSessionsErrors](../../models/sdkerrors/getsessionssessionserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsourceconnectioninformationauthenticationerrors.md b/docs/models/sdkerrors/getsourceconnectioninformationauthenticationerrors.md new file mode 100644 index 0000000..eb35965 --- /dev/null +++ b/docs/models/sdkerrors/getsourceconnectioninformationauthenticationerrors.md @@ -0,0 +1,10 @@ +# GetSourceConnectionInformationAuthenticationErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsourceconnectioninformationauthenticationresponsebody.md b/docs/models/sdkerrors/getsourceconnectioninformationauthenticationresponsebody.md new file mode 100644 index 0000000..13d3689 --- /dev/null +++ b/docs/models/sdkerrors/getsourceconnectioninformationauthenticationresponsebody.md @@ -0,0 +1,11 @@ +# GetSourceConnectionInformationAuthenticationResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetSourceConnectionInformationAuthenticationErrors](../../models/sdkerrors/getsourceconnectioninformationauthenticationerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsourceconnectioninformationerrors.md b/docs/models/sdkerrors/getsourceconnectioninformationerrors.md index dc5b988..f9c11a4 100644 --- a/docs/models/sdkerrors/getsourceconnectioninformationerrors.md +++ b/docs/models/sdkerrors/getsourceconnectioninformationerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getsourceconnectioninformationresponsebody.md b/docs/models/sdkerrors/getsourceconnectioninformationresponsebody.md index 2f0138b..98c3253 100644 --- a/docs/models/sdkerrors/getsourceconnectioninformationresponsebody.md +++ b/docs/models/sdkerrors/getsourceconnectioninformationresponsebody.md @@ -1,6 +1,6 @@ # GetSourceConnectionInformationResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getstatisticserrors.md b/docs/models/sdkerrors/getstatisticserrors.md index 149d135..f5826f6 100644 --- a/docs/models/sdkerrors/getstatisticserrors.md +++ b/docs/models/sdkerrors/getstatisticserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getstatisticsresponsebody.md b/docs/models/sdkerrors/getstatisticsresponsebody.md index a13d52e..1aa374f 100644 --- a/docs/models/sdkerrors/getstatisticsresponsebody.md +++ b/docs/models/sdkerrors/getstatisticsresponsebody.md @@ -1,6 +1,6 @@ # GetStatisticsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getstatisticsstatisticserrors.md b/docs/models/sdkerrors/getstatisticsstatisticserrors.md new file mode 100644 index 0000000..3d6090a --- /dev/null +++ b/docs/models/sdkerrors/getstatisticsstatisticserrors.md @@ -0,0 +1,10 @@ +# GetStatisticsStatisticsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getstatisticsstatisticsresponsebody.md b/docs/models/sdkerrors/getstatisticsstatisticsresponsebody.md new file mode 100644 index 0000000..2b6b2f3 --- /dev/null +++ b/docs/models/sdkerrors/getstatisticsstatisticsresponsebody.md @@ -0,0 +1,11 @@ +# GetStatisticsStatisticsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetStatisticsStatisticsErrors](../../models/sdkerrors/getstatisticsstatisticserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getthumbimageerrors.md b/docs/models/sdkerrors/getthumbimageerrors.md new file mode 100644 index 0000000..5797577 --- /dev/null +++ b/docs/models/sdkerrors/getthumbimageerrors.md @@ -0,0 +1,10 @@ +# GetThumbImageErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getthumbimagemediaerrors.md b/docs/models/sdkerrors/getthumbimagemediaerrors.md new file mode 100644 index 0000000..e042529 --- /dev/null +++ b/docs/models/sdkerrors/getthumbimagemediaerrors.md @@ -0,0 +1,10 @@ +# GetThumbImageMediaErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getthumbimagemediaresponsebody.md b/docs/models/sdkerrors/getthumbimagemediaresponsebody.md new file mode 100644 index 0000000..bb582f2 --- /dev/null +++ b/docs/models/sdkerrors/getthumbimagemediaresponsebody.md @@ -0,0 +1,11 @@ +# GetThumbImageMediaResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetThumbImageMediaErrors](../../models/sdkerrors/getthumbimagemediaerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/searchlibraryresponsebody.md b/docs/models/sdkerrors/getthumbimageresponsebody.md similarity index 83% rename from docs/models/sdkerrors/searchlibraryresponsebody.md rename to docs/models/sdkerrors/getthumbimageresponsebody.md index 06dfe71..e3afc7d 100644 --- a/docs/models/sdkerrors/searchlibraryresponsebody.md +++ b/docs/models/sdkerrors/getthumbimageresponsebody.md @@ -1,11 +1,11 @@ -# SearchLibraryResponseBody +# GetThumbImageResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields | Field | Type | Required | Description | | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -| `Errors` | [][sdkerrors.SearchLibraryErrors](../../models/sdkerrors/searchlibraryerrors.md) | :heavy_minus_sign: | N/A | +| `Errors` | [][sdkerrors.GetThumbImageErrors](../../models/sdkerrors/getthumbimageerrors.md) | :heavy_minus_sign: | N/A | | `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettimelineerrors.md b/docs/models/sdkerrors/gettimelineerrors.md index 0d10670..677c6a1 100644 --- a/docs/models/sdkerrors/gettimelineerrors.md +++ b/docs/models/sdkerrors/gettimelineerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettimelineresponsebody.md b/docs/models/sdkerrors/gettimelineresponsebody.md index c65bca1..1731cd9 100644 --- a/docs/models/sdkerrors/gettimelineresponsebody.md +++ b/docs/models/sdkerrors/gettimelineresponsebody.md @@ -1,6 +1,6 @@ # GetTimelineResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/gettimelinevideoerrors.md b/docs/models/sdkerrors/gettimelinevideoerrors.md new file mode 100644 index 0000000..552aa89 --- /dev/null +++ b/docs/models/sdkerrors/gettimelinevideoerrors.md @@ -0,0 +1,10 @@ +# GetTimelineVideoErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettimelinevideoresponsebody.md b/docs/models/sdkerrors/gettimelinevideoresponsebody.md new file mode 100644 index 0000000..8ac6840 --- /dev/null +++ b/docs/models/sdkerrors/gettimelinevideoresponsebody.md @@ -0,0 +1,11 @@ +# GetTimelineVideoResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetTimelineVideoErrors](../../models/sdkerrors/gettimelinevideoerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettokenbypiniderrors.md b/docs/models/sdkerrors/gettokenbypiniderrors.md new file mode 100644 index 0000000..127d950 --- /dev/null +++ b/docs/models/sdkerrors/gettokenbypiniderrors.md @@ -0,0 +1,10 @@ +# GetTokenByPinIDErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettokenbypinidplexerrors.md b/docs/models/sdkerrors/gettokenbypinidplexerrors.md new file mode 100644 index 0000000..d443c60 --- /dev/null +++ b/docs/models/sdkerrors/gettokenbypinidplexerrors.md @@ -0,0 +1,9 @@ +# GetTokenByPinIDPlexErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------- | ------------------------- | ------------------------- | ------------------------- | ------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1020 | +| `Message` | **string* | :heavy_minus_sign: | N/A | Code not found or expired | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettokenbypinidplexresponsebody.md b/docs/models/sdkerrors/gettokenbypinidplexresponsebody.md new file mode 100644 index 0000000..bc152b8 --- /dev/null +++ b/docs/models/sdkerrors/gettokenbypinidplexresponsebody.md @@ -0,0 +1,11 @@ +# GetTokenByPinIDPlexResponseBody + +Not Found or Expired + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetTokenByPinIDPlexErrors](../../models/sdkerrors/gettokenbypinidplexerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettokenbypinidresponsebody.md b/docs/models/sdkerrors/gettokenbypinidresponsebody.md new file mode 100644 index 0000000..334b0d9 --- /dev/null +++ b/docs/models/sdkerrors/gettokenbypinidresponsebody.md @@ -0,0 +1,11 @@ +# GetTokenByPinIDResponseBody + +Bad Request response when the X-Plex-Client-Identifier is missing + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetTokenByPinIDErrors](../../models/sdkerrors/gettokenbypiniderrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettokenresponsebody.md b/docs/models/sdkerrors/gettokenresponsebody.md deleted file mode 100644 index bfb21c0..0000000 --- a/docs/models/sdkerrors/gettokenresponsebody.md +++ /dev/null @@ -1,11 +0,0 @@ -# GetTokenResponseBody - -X-Plex-Client-Identifier is missing - - -## Fields - -| Field | Type | Required | Description | -| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | -| `Errors` | [][sdkerrors.GetTokenErrors](../../models/sdkerrors/gettokenerrors.md) | :heavy_minus_sign: | N/A | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettopwatchedcontenterrors.md b/docs/models/sdkerrors/gettopwatchedcontenterrors.md new file mode 100644 index 0000000..2a58b7a --- /dev/null +++ b/docs/models/sdkerrors/gettopwatchedcontenterrors.md @@ -0,0 +1,10 @@ +# GetTopWatchedContentErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettopwatchedcontentlibraryerrors.md b/docs/models/sdkerrors/gettopwatchedcontentlibraryerrors.md new file mode 100644 index 0000000..d5a5139 --- /dev/null +++ b/docs/models/sdkerrors/gettopwatchedcontentlibraryerrors.md @@ -0,0 +1,10 @@ +# GetTopWatchedContentLibraryErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettopwatchedcontentlibraryresponsebody.md b/docs/models/sdkerrors/gettopwatchedcontentlibraryresponsebody.md new file mode 100644 index 0000000..7bfc2f0 --- /dev/null +++ b/docs/models/sdkerrors/gettopwatchedcontentlibraryresponsebody.md @@ -0,0 +1,11 @@ +# GetTopWatchedContentLibraryResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetTopWatchedContentLibraryErrors](../../models/sdkerrors/gettopwatchedcontentlibraryerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettopwatchedcontentresponsebody.md b/docs/models/sdkerrors/gettopwatchedcontentresponsebody.md new file mode 100644 index 0000000..6d05a76 --- /dev/null +++ b/docs/models/sdkerrors/gettopwatchedcontentresponsebody.md @@ -0,0 +1,11 @@ +# GetTopWatchedContentResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetTopWatchedContentErrors](../../models/sdkerrors/gettopwatchedcontenterrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettranscodesessionserrors.md b/docs/models/sdkerrors/gettranscodesessionserrors.md index 8396f89..b17d5b1 100644 --- a/docs/models/sdkerrors/gettranscodesessionserrors.md +++ b/docs/models/sdkerrors/gettranscodesessionserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettranscodesessionsresponsebody.md b/docs/models/sdkerrors/gettranscodesessionsresponsebody.md index d994522..18391c3 100644 --- a/docs/models/sdkerrors/gettranscodesessionsresponsebody.md +++ b/docs/models/sdkerrors/gettranscodesessionsresponsebody.md @@ -1,6 +1,6 @@ # GetTranscodeSessionsResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/gettranscodesessionssessionserrors.md b/docs/models/sdkerrors/gettranscodesessionssessionserrors.md new file mode 100644 index 0000000..cb9af42 --- /dev/null +++ b/docs/models/sdkerrors/gettranscodesessionssessionserrors.md @@ -0,0 +1,10 @@ +# GetTranscodeSessionsSessionsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettranscodesessionssessionsresponsebody.md b/docs/models/sdkerrors/gettranscodesessionssessionsresponsebody.md new file mode 100644 index 0000000..5d05cf6 --- /dev/null +++ b/docs/models/sdkerrors/gettranscodesessionssessionsresponsebody.md @@ -0,0 +1,11 @@ +# GetTranscodeSessionsSessionsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetTranscodeSessionsSessionsErrors](../../models/sdkerrors/gettranscodesessionssessionserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettransienttokenauthenticationerrors.md b/docs/models/sdkerrors/gettransienttokenauthenticationerrors.md new file mode 100644 index 0000000..b10acdd --- /dev/null +++ b/docs/models/sdkerrors/gettransienttokenauthenticationerrors.md @@ -0,0 +1,10 @@ +# GetTransientTokenAuthenticationErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettransienttokenauthenticationresponsebody.md b/docs/models/sdkerrors/gettransienttokenauthenticationresponsebody.md new file mode 100644 index 0000000..d73ae04 --- /dev/null +++ b/docs/models/sdkerrors/gettransienttokenauthenticationresponsebody.md @@ -0,0 +1,11 @@ +# GetTransientTokenAuthenticationResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetTransientTokenAuthenticationErrors](../../models/sdkerrors/gettransienttokenauthenticationerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettransienttokenerrors.md b/docs/models/sdkerrors/gettransienttokenerrors.md index 9998026..68abe40 100644 --- a/docs/models/sdkerrors/gettransienttokenerrors.md +++ b/docs/models/sdkerrors/gettransienttokenerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/gettransienttokenresponsebody.md b/docs/models/sdkerrors/gettransienttokenresponsebody.md index c5f037f..0708bbf 100644 --- a/docs/models/sdkerrors/gettransienttokenresponsebody.md +++ b/docs/models/sdkerrors/gettransienttokenresponsebody.md @@ -1,6 +1,6 @@ # GetTransientTokenResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getupdatestatuserrors.md b/docs/models/sdkerrors/getupdatestatuserrors.md index f0be32d..b7ea821 100644 --- a/docs/models/sdkerrors/getupdatestatuserrors.md +++ b/docs/models/sdkerrors/getupdatestatuserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getupdatestatusresponsebody.md b/docs/models/sdkerrors/getupdatestatusresponsebody.md index 7d914a6..f5bc757 100644 --- a/docs/models/sdkerrors/getupdatestatusresponsebody.md +++ b/docs/models/sdkerrors/getupdatestatusresponsebody.md @@ -1,6 +1,6 @@ # GetUpdateStatusResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getupdatestatusupdatererrors.md b/docs/models/sdkerrors/getupdatestatusupdatererrors.md new file mode 100644 index 0000000..1a9fca9 --- /dev/null +++ b/docs/models/sdkerrors/getupdatestatusupdatererrors.md @@ -0,0 +1,10 @@ +# GetUpdateStatusUpdaterErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getupdatestatusupdaterresponsebody.md b/docs/models/sdkerrors/getupdatestatusupdaterresponsebody.md new file mode 100644 index 0000000..f21f549 --- /dev/null +++ b/docs/models/sdkerrors/getupdatestatusupdaterresponsebody.md @@ -0,0 +1,11 @@ +# GetUpdateStatusUpdaterResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetUpdateStatusUpdaterErrors](../../models/sdkerrors/getupdatestatusupdatererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getuserdetailsauthenticationerrors.md b/docs/models/sdkerrors/getuserdetailsauthenticationerrors.md new file mode 100644 index 0000000..39465fd --- /dev/null +++ b/docs/models/sdkerrors/getuserdetailsauthenticationerrors.md @@ -0,0 +1,10 @@ +# GetUserDetailsAuthenticationErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getuserdetailsauthenticationresponsebody.md b/docs/models/sdkerrors/getuserdetailsauthenticationresponsebody.md new file mode 100644 index 0000000..faa5986 --- /dev/null +++ b/docs/models/sdkerrors/getuserdetailsauthenticationresponsebody.md @@ -0,0 +1,11 @@ +# GetUserDetailsAuthenticationResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetUserDetailsAuthenticationErrors](../../models/sdkerrors/getuserdetailsauthenticationerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getuserdetailserrors.md b/docs/models/sdkerrors/getuserdetailserrors.md new file mode 100644 index 0000000..d055c44 --- /dev/null +++ b/docs/models/sdkerrors/getuserdetailserrors.md @@ -0,0 +1,10 @@ +# GetUserDetailsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getuserdetailsresponsebody.md b/docs/models/sdkerrors/getuserdetailsresponsebody.md new file mode 100644 index 0000000..0e03458 --- /dev/null +++ b/docs/models/sdkerrors/getuserdetailsresponsebody.md @@ -0,0 +1,11 @@ +# GetUserDetailsResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetUserDetailsErrors](../../models/sdkerrors/getuserdetailserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getuserfriendserrors.md b/docs/models/sdkerrors/getuserfriendserrors.md new file mode 100644 index 0000000..64fa5d5 --- /dev/null +++ b/docs/models/sdkerrors/getuserfriendserrors.md @@ -0,0 +1,10 @@ +# GetUserFriendsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getuserfriendsplexerrors.md b/docs/models/sdkerrors/getuserfriendsplexerrors.md new file mode 100644 index 0000000..85df191 --- /dev/null +++ b/docs/models/sdkerrors/getuserfriendsplexerrors.md @@ -0,0 +1,10 @@ +# GetUserFriendsPlexErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getuserfriendsplexresponsebody.md b/docs/models/sdkerrors/getuserfriendsplexresponsebody.md new file mode 100644 index 0000000..f9805ea --- /dev/null +++ b/docs/models/sdkerrors/getuserfriendsplexresponsebody.md @@ -0,0 +1,11 @@ +# GetUserFriendsPlexResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetUserFriendsPlexErrors](../../models/sdkerrors/getuserfriendsplexerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getuserfriendsresponsebody.md b/docs/models/sdkerrors/getuserfriendsresponsebody.md new file mode 100644 index 0000000..8a729d4 --- /dev/null +++ b/docs/models/sdkerrors/getuserfriendsresponsebody.md @@ -0,0 +1,11 @@ +# GetUserFriendsResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.GetUserFriendsErrors](../../models/sdkerrors/getuserfriendserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getwatchlisterrors.md b/docs/models/sdkerrors/getwatchlisterrors.md index 18e8941..600b641 100644 --- a/docs/models/sdkerrors/getwatchlisterrors.md +++ b/docs/models/sdkerrors/getwatchlisterrors.md @@ -1,10 +1,10 @@ -# GetWatchlistErrors +# GetWatchListErrors ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getwatchlistresponsebody.md b/docs/models/sdkerrors/getwatchlistresponsebody.md index 02f48f4..7deab3a 100644 --- a/docs/models/sdkerrors/getwatchlistresponsebody.md +++ b/docs/models/sdkerrors/getwatchlistresponsebody.md @@ -1,11 +1,11 @@ -# GetWatchlistResponseBody +# GetWatchListResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields | Field | Type | Required | Description | | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | -| `Errors` | [][sdkerrors.GetWatchlistErrors](../../models/sdkerrors/getwatchlisterrors.md) | :heavy_minus_sign: | N/A | +| `Errors` | [][sdkerrors.GetWatchListErrors](../../models/sdkerrors/getwatchlisterrors.md) | :heavy_minus_sign: | N/A | | `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/getwatchlistwatchlisterrors.md b/docs/models/sdkerrors/getwatchlistwatchlisterrors.md new file mode 100644 index 0000000..6358b22 --- /dev/null +++ b/docs/models/sdkerrors/getwatchlistwatchlisterrors.md @@ -0,0 +1,10 @@ +# GetWatchListWatchlistErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getwatchlistwatchlistresponsebody.md b/docs/models/sdkerrors/getwatchlistwatchlistresponsebody.md new file mode 100644 index 0000000..a16a54b --- /dev/null +++ b/docs/models/sdkerrors/getwatchlistwatchlistresponsebody.md @@ -0,0 +1,11 @@ +# GetWatchListWatchlistResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.GetWatchListWatchlistErrors](../../models/sdkerrors/getwatchlistwatchlisterrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/loglineerrors.md b/docs/models/sdkerrors/loglineerrors.md index 9ecfeb5..ca201cf 100644 --- a/docs/models/sdkerrors/loglineerrors.md +++ b/docs/models/sdkerrors/loglineerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibraryerrors.md b/docs/models/sdkerrors/loglinelogerrors.md similarity index 83% rename from docs/models/sdkerrors/getlibraryerrors.md rename to docs/models/sdkerrors/loglinelogerrors.md index 44566f1..002656a 100644 --- a/docs/models/sdkerrors/getlibraryerrors.md +++ b/docs/models/sdkerrors/loglinelogerrors.md @@ -1,10 +1,10 @@ -# GetLibraryErrors +# LogLineLogErrors ## Fields | Field | Type | Required | Description | Example | | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | | `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/getlibraryresponsebody.md b/docs/models/sdkerrors/loglinelogresponsebody.md similarity index 88% rename from docs/models/sdkerrors/getlibraryresponsebody.md rename to docs/models/sdkerrors/loglinelogresponsebody.md index fec3991..9c369f9 100644 --- a/docs/models/sdkerrors/getlibraryresponsebody.md +++ b/docs/models/sdkerrors/loglinelogresponsebody.md @@ -1,4 +1,4 @@ -# GetLibraryResponseBody +# LogLineLogResponseBody Unauthorized - Returned if the X-Plex-Token is missing from the header or query. @@ -7,5 +7,5 @@ Unauthorized - Returned if the X-Plex-Token is missing from the header or query. | Field | Type | Required | Description | | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| `Errors` | [][sdkerrors.GetLibraryErrors](../../models/sdkerrors/getlibraryerrors.md) | :heavy_minus_sign: | N/A | +| `Errors` | [][sdkerrors.LogLineLogErrors](../../models/sdkerrors/loglinelogerrors.md) | :heavy_minus_sign: | N/A | | `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/loglineresponsebody.md b/docs/models/sdkerrors/loglineresponsebody.md index adb3357..3097551 100644 --- a/docs/models/sdkerrors/loglineresponsebody.md +++ b/docs/models/sdkerrors/loglineresponsebody.md @@ -1,6 +1,6 @@ # LogLineResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/logmultilineerrors.md b/docs/models/sdkerrors/logmultilineerrors.md index d1324d3..03179cc 100644 --- a/docs/models/sdkerrors/logmultilineerrors.md +++ b/docs/models/sdkerrors/logmultilineerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/logmultilinelogerrors.md b/docs/models/sdkerrors/logmultilinelogerrors.md new file mode 100644 index 0000000..1fd2106 --- /dev/null +++ b/docs/models/sdkerrors/logmultilinelogerrors.md @@ -0,0 +1,10 @@ +# LogMultiLineLogErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/logmultilinelogresponsebody.md b/docs/models/sdkerrors/logmultilinelogresponsebody.md new file mode 100644 index 0000000..732b507 --- /dev/null +++ b/docs/models/sdkerrors/logmultilinelogresponsebody.md @@ -0,0 +1,11 @@ +# LogMultiLineLogResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.LogMultiLineLogErrors](../../models/sdkerrors/logmultilinelogerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/logmultilineresponsebody.md b/docs/models/sdkerrors/logmultilineresponsebody.md index 8dee57d..7fa51be 100644 --- a/docs/models/sdkerrors/logmultilineresponsebody.md +++ b/docs/models/sdkerrors/logmultilineresponsebody.md @@ -1,6 +1,6 @@ # LogMultiLineResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/markplayederrors.md b/docs/models/sdkerrors/markplayederrors.md index 478979c..776a0b6 100644 --- a/docs/models/sdkerrors/markplayederrors.md +++ b/docs/models/sdkerrors/markplayederrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/markplayedmediaerrors.md b/docs/models/sdkerrors/markplayedmediaerrors.md new file mode 100644 index 0000000..d89c8f0 --- /dev/null +++ b/docs/models/sdkerrors/markplayedmediaerrors.md @@ -0,0 +1,10 @@ +# MarkPlayedMediaErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/markplayedmediaresponsebody.md b/docs/models/sdkerrors/markplayedmediaresponsebody.md new file mode 100644 index 0000000..6e9070e --- /dev/null +++ b/docs/models/sdkerrors/markplayedmediaresponsebody.md @@ -0,0 +1,11 @@ +# MarkPlayedMediaResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.MarkPlayedMediaErrors](../../models/sdkerrors/markplayedmediaerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/markplayedresponsebody.md b/docs/models/sdkerrors/markplayedresponsebody.md index f264a8e..936cf1f 100644 --- a/docs/models/sdkerrors/markplayedresponsebody.md +++ b/docs/models/sdkerrors/markplayedresponsebody.md @@ -1,6 +1,6 @@ # MarkPlayedResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/markunplayederrors.md b/docs/models/sdkerrors/markunplayederrors.md index eb3f42e..8931877 100644 --- a/docs/models/sdkerrors/markunplayederrors.md +++ b/docs/models/sdkerrors/markunplayederrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/markunplayedmediaerrors.md b/docs/models/sdkerrors/markunplayedmediaerrors.md new file mode 100644 index 0000000..9ec3572 --- /dev/null +++ b/docs/models/sdkerrors/markunplayedmediaerrors.md @@ -0,0 +1,10 @@ +# MarkUnplayedMediaErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/markunplayedmediaresponsebody.md b/docs/models/sdkerrors/markunplayedmediaresponsebody.md new file mode 100644 index 0000000..d5982ab --- /dev/null +++ b/docs/models/sdkerrors/markunplayedmediaresponsebody.md @@ -0,0 +1,11 @@ +# MarkUnplayedMediaResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.MarkUnplayedMediaErrors](../../models/sdkerrors/markunplayedmediaerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/markunplayedresponsebody.md b/docs/models/sdkerrors/markunplayedresponsebody.md index aeebdbb..8c76ecd 100644 --- a/docs/models/sdkerrors/markunplayedresponsebody.md +++ b/docs/models/sdkerrors/markunplayedresponsebody.md @@ -1,6 +1,6 @@ # MarkUnplayedResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/performsearcherrors.md b/docs/models/sdkerrors/performsearcherrors.md index 3a0bff8..3454420 100644 --- a/docs/models/sdkerrors/performsearcherrors.md +++ b/docs/models/sdkerrors/performsearcherrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/performsearchresponsebody.md b/docs/models/sdkerrors/performsearchresponsebody.md index 922640b..a5f263b 100644 --- a/docs/models/sdkerrors/performsearchresponsebody.md +++ b/docs/models/sdkerrors/performsearchresponsebody.md @@ -1,6 +1,6 @@ # PerformSearchResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/performsearchsearcherrors.md b/docs/models/sdkerrors/performsearchsearcherrors.md new file mode 100644 index 0000000..95e06a9 --- /dev/null +++ b/docs/models/sdkerrors/performsearchsearcherrors.md @@ -0,0 +1,10 @@ +# PerformSearchSearchErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/performsearchsearchresponsebody.md b/docs/models/sdkerrors/performsearchsearchresponsebody.md new file mode 100644 index 0000000..499b046 --- /dev/null +++ b/docs/models/sdkerrors/performsearchsearchresponsebody.md @@ -0,0 +1,11 @@ +# PerformSearchSearchResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.PerformSearchSearchErrors](../../models/sdkerrors/performsearchsearcherrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/performvoicesearcherrors.md b/docs/models/sdkerrors/performvoicesearcherrors.md index 2b29a7e..db0ca77 100644 --- a/docs/models/sdkerrors/performvoicesearcherrors.md +++ b/docs/models/sdkerrors/performvoicesearcherrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/performvoicesearchresponsebody.md b/docs/models/sdkerrors/performvoicesearchresponsebody.md index e7b1102..c5d7074 100644 --- a/docs/models/sdkerrors/performvoicesearchresponsebody.md +++ b/docs/models/sdkerrors/performvoicesearchresponsebody.md @@ -1,6 +1,6 @@ # PerformVoiceSearchResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/performvoicesearchsearcherrors.md b/docs/models/sdkerrors/performvoicesearchsearcherrors.md new file mode 100644 index 0000000..4d5bc56 --- /dev/null +++ b/docs/models/sdkerrors/performvoicesearchsearcherrors.md @@ -0,0 +1,10 @@ +# PerformVoiceSearchSearchErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/performvoicesearchsearchresponsebody.md b/docs/models/sdkerrors/performvoicesearchsearchresponsebody.md new file mode 100644 index 0000000..d59de55 --- /dev/null +++ b/docs/models/sdkerrors/performvoicesearchsearchresponsebody.md @@ -0,0 +1,11 @@ +# PerformVoiceSearchSearchResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.PerformVoiceSearchSearchErrors](../../models/sdkerrors/performvoicesearchsearcherrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/postuserssignindataauthenticationerrors.md b/docs/models/sdkerrors/postuserssignindataauthenticationerrors.md new file mode 100644 index 0000000..8054ea5 --- /dev/null +++ b/docs/models/sdkerrors/postuserssignindataauthenticationerrors.md @@ -0,0 +1,10 @@ +# PostUsersSignInDataAuthenticationErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/postuserssignindataauthenticationresponsebody.md b/docs/models/sdkerrors/postuserssignindataauthenticationresponsebody.md new file mode 100644 index 0000000..aa55d82 --- /dev/null +++ b/docs/models/sdkerrors/postuserssignindataauthenticationresponsebody.md @@ -0,0 +1,11 @@ +# PostUsersSignInDataAuthenticationResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.PostUsersSignInDataAuthenticationErrors](../../models/sdkerrors/postuserssignindataauthenticationerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/postuserssignindataerrors.md b/docs/models/sdkerrors/postuserssignindataerrors.md new file mode 100644 index 0000000..8394f9c --- /dev/null +++ b/docs/models/sdkerrors/postuserssignindataerrors.md @@ -0,0 +1,10 @@ +# PostUsersSignInDataErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/postuserssignindataresponsebody.md b/docs/models/sdkerrors/postuserssignindataresponsebody.md new file mode 100644 index 0000000..3871481 --- /dev/null +++ b/docs/models/sdkerrors/postuserssignindataresponsebody.md @@ -0,0 +1,11 @@ +# PostUsersSignInDataResponseBody + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.PostUsersSignInDataErrors](../../models/sdkerrors/postuserssignindataerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/searchlibraryerrors.md b/docs/models/sdkerrors/searchlibraryerrors.md deleted file mode 100644 index af08623..0000000 --- a/docs/models/sdkerrors/searchlibraryerrors.md +++ /dev/null @@ -1,10 +0,0 @@ -# SearchLibraryErrors - - -## Fields - -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/startalltasksbutlererrors.md b/docs/models/sdkerrors/startalltasksbutlererrors.md new file mode 100644 index 0000000..6603030 --- /dev/null +++ b/docs/models/sdkerrors/startalltasksbutlererrors.md @@ -0,0 +1,10 @@ +# StartAllTasksButlerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/startalltasksbutlerresponsebody.md b/docs/models/sdkerrors/startalltasksbutlerresponsebody.md new file mode 100644 index 0000000..9413052 --- /dev/null +++ b/docs/models/sdkerrors/startalltasksbutlerresponsebody.md @@ -0,0 +1,11 @@ +# StartAllTasksButlerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.StartAllTasksButlerErrors](../../models/sdkerrors/startalltasksbutlererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/startalltaskserrors.md b/docs/models/sdkerrors/startalltaskserrors.md index bf93806..c5b1ae8 100644 --- a/docs/models/sdkerrors/startalltaskserrors.md +++ b/docs/models/sdkerrors/startalltaskserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/startalltasksresponsebody.md b/docs/models/sdkerrors/startalltasksresponsebody.md index bc2b7f1..50fcc16 100644 --- a/docs/models/sdkerrors/startalltasksresponsebody.md +++ b/docs/models/sdkerrors/startalltasksresponsebody.md @@ -1,6 +1,6 @@ # StartAllTasksResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/starttaskbutlererrors.md b/docs/models/sdkerrors/starttaskbutlererrors.md new file mode 100644 index 0000000..7d8c220 --- /dev/null +++ b/docs/models/sdkerrors/starttaskbutlererrors.md @@ -0,0 +1,10 @@ +# StartTaskButlerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/starttaskbutlerresponsebody.md b/docs/models/sdkerrors/starttaskbutlerresponsebody.md new file mode 100644 index 0000000..3be0d11 --- /dev/null +++ b/docs/models/sdkerrors/starttaskbutlerresponsebody.md @@ -0,0 +1,11 @@ +# StartTaskButlerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.StartTaskButlerErrors](../../models/sdkerrors/starttaskbutlererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/starttaskerrors.md b/docs/models/sdkerrors/starttaskerrors.md index a8bbf2a..64fe306 100644 --- a/docs/models/sdkerrors/starttaskerrors.md +++ b/docs/models/sdkerrors/starttaskerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/starttaskresponsebody.md b/docs/models/sdkerrors/starttaskresponsebody.md index e502eef..f7b7449 100644 --- a/docs/models/sdkerrors/starttaskresponsebody.md +++ b/docs/models/sdkerrors/starttaskresponsebody.md @@ -1,6 +1,6 @@ # StartTaskResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/startuniversaltranscodeerrors.md b/docs/models/sdkerrors/startuniversaltranscodeerrors.md index 99f47d7..fc37779 100644 --- a/docs/models/sdkerrors/startuniversaltranscodeerrors.md +++ b/docs/models/sdkerrors/startuniversaltranscodeerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/startuniversaltranscoderesponsebody.md b/docs/models/sdkerrors/startuniversaltranscoderesponsebody.md index 0d297e4..2a34f40 100644 --- a/docs/models/sdkerrors/startuniversaltranscoderesponsebody.md +++ b/docs/models/sdkerrors/startuniversaltranscoderesponsebody.md @@ -1,6 +1,6 @@ # StartUniversalTranscodeResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/startuniversaltranscodevideoerrors.md b/docs/models/sdkerrors/startuniversaltranscodevideoerrors.md new file mode 100644 index 0000000..5a9ed25 --- /dev/null +++ b/docs/models/sdkerrors/startuniversaltranscodevideoerrors.md @@ -0,0 +1,10 @@ +# StartUniversalTranscodeVideoErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/startuniversaltranscodevideoresponsebody.md b/docs/models/sdkerrors/startuniversaltranscodevideoresponsebody.md new file mode 100644 index 0000000..4da69fc --- /dev/null +++ b/docs/models/sdkerrors/startuniversaltranscodevideoresponsebody.md @@ -0,0 +1,11 @@ +# StartUniversalTranscodeVideoResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.StartUniversalTranscodeVideoErrors](../../models/sdkerrors/startuniversaltranscodevideoerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/stopalltasksbutlererrors.md b/docs/models/sdkerrors/stopalltasksbutlererrors.md new file mode 100644 index 0000000..e0942c2 --- /dev/null +++ b/docs/models/sdkerrors/stopalltasksbutlererrors.md @@ -0,0 +1,10 @@ +# StopAllTasksButlerErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/stopalltasksbutlerresponsebody.md b/docs/models/sdkerrors/stopalltasksbutlerresponsebody.md new file mode 100644 index 0000000..1e135ae --- /dev/null +++ b/docs/models/sdkerrors/stopalltasksbutlerresponsebody.md @@ -0,0 +1,11 @@ +# StopAllTasksButlerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `Errors` | [][sdkerrors.StopAllTasksButlerErrors](../../models/sdkerrors/stopalltasksbutlererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/stopalltaskserrors.md b/docs/models/sdkerrors/stopalltaskserrors.md index a735b0c..002f827 100644 --- a/docs/models/sdkerrors/stopalltaskserrors.md +++ b/docs/models/sdkerrors/stopalltaskserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/stopalltasksresponsebody.md b/docs/models/sdkerrors/stopalltasksresponsebody.md index f545559..1bc115d 100644 --- a/docs/models/sdkerrors/stopalltasksresponsebody.md +++ b/docs/models/sdkerrors/stopalltasksresponsebody.md @@ -1,6 +1,6 @@ # StopAllTasksResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/getmetadataerrors.md b/docs/models/sdkerrors/stoptaskbutlererrors.md similarity index 83% rename from docs/models/sdkerrors/getmetadataerrors.md rename to docs/models/sdkerrors/stoptaskbutlererrors.md index af6b73f..2779f90 100644 --- a/docs/models/sdkerrors/getmetadataerrors.md +++ b/docs/models/sdkerrors/stoptaskbutlererrors.md @@ -1,10 +1,10 @@ -# GetMetadataErrors +# StopTaskButlerErrors ## Fields | Field | Type | Required | Description | Example | | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | | `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/stoptaskbutlerresponsebody.md b/docs/models/sdkerrors/stoptaskbutlerresponsebody.md new file mode 100644 index 0000000..787a0b2 --- /dev/null +++ b/docs/models/sdkerrors/stoptaskbutlerresponsebody.md @@ -0,0 +1,11 @@ +# StopTaskButlerResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.StopTaskButlerErrors](../../models/sdkerrors/stoptaskbutlererrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/stoptaskerrors.md b/docs/models/sdkerrors/stoptaskerrors.md index af6ed53..0f4d984 100644 --- a/docs/models/sdkerrors/stoptaskerrors.md +++ b/docs/models/sdkerrors/stoptaskerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/stoptaskresponsebody.md b/docs/models/sdkerrors/stoptaskresponsebody.md index ecd2b8b..af567a7 100644 --- a/docs/models/sdkerrors/stoptaskresponsebody.md +++ b/docs/models/sdkerrors/stoptaskresponsebody.md @@ -1,6 +1,6 @@ # StopTaskResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/stoptranscodesessionerrors.md b/docs/models/sdkerrors/stoptranscodesessionerrors.md index aa4c27c..98a7447 100644 --- a/docs/models/sdkerrors/stoptranscodesessionerrors.md +++ b/docs/models/sdkerrors/stoptranscodesessionerrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/stoptranscodesessionresponsebody.md b/docs/models/sdkerrors/stoptranscodesessionresponsebody.md index cb9e2d4..cb69e26 100644 --- a/docs/models/sdkerrors/stoptranscodesessionresponsebody.md +++ b/docs/models/sdkerrors/stoptranscodesessionresponsebody.md @@ -1,6 +1,6 @@ # StopTranscodeSessionResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/stoptranscodesessionsessionserrors.md b/docs/models/sdkerrors/stoptranscodesessionsessionserrors.md new file mode 100644 index 0000000..cf46ebd --- /dev/null +++ b/docs/models/sdkerrors/stoptranscodesessionsessionserrors.md @@ -0,0 +1,10 @@ +# StopTranscodeSessionSessionsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/stoptranscodesessionsessionsresponsebody.md b/docs/models/sdkerrors/stoptranscodesessionsessionsresponsebody.md new file mode 100644 index 0000000..5dc3776 --- /dev/null +++ b/docs/models/sdkerrors/stoptranscodesessionsessionsresponsebody.md @@ -0,0 +1,11 @@ +# StopTranscodeSessionSessionsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.StopTranscodeSessionSessionsErrors](../../models/sdkerrors/stoptranscodesessionsessionserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/updateplaylisterrors.md b/docs/models/sdkerrors/updateplaylisterrors.md index 005e500..3c582a0 100644 --- a/docs/models/sdkerrors/updateplaylisterrors.md +++ b/docs/models/sdkerrors/updateplaylisterrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/updateplaylistplaylistserrors.md b/docs/models/sdkerrors/updateplaylistplaylistserrors.md new file mode 100644 index 0000000..6b1f8fb --- /dev/null +++ b/docs/models/sdkerrors/updateplaylistplaylistserrors.md @@ -0,0 +1,10 @@ +# UpdatePlaylistPlaylistsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/updateplaylistplaylistsresponsebody.md b/docs/models/sdkerrors/updateplaylistplaylistsresponsebody.md new file mode 100644 index 0000000..899840c --- /dev/null +++ b/docs/models/sdkerrors/updateplaylistplaylistsresponsebody.md @@ -0,0 +1,11 @@ +# UpdatePlaylistPlaylistsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.UpdatePlaylistPlaylistsErrors](../../models/sdkerrors/updateplaylistplaylistserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/updateplaylistresponsebody.md b/docs/models/sdkerrors/updateplaylistresponsebody.md index c1719e7..8d35d84 100644 --- a/docs/models/sdkerrors/updateplaylistresponsebody.md +++ b/docs/models/sdkerrors/updateplaylistresponsebody.md @@ -1,6 +1,6 @@ # UpdatePlaylistResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/updateplayprogresserrors.md b/docs/models/sdkerrors/updateplayprogresserrors.md index 82fca4b..2c69762 100644 --- a/docs/models/sdkerrors/updateplayprogresserrors.md +++ b/docs/models/sdkerrors/updateplayprogresserrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/updateplayprogressmediaerrors.md b/docs/models/sdkerrors/updateplayprogressmediaerrors.md new file mode 100644 index 0000000..c679295 --- /dev/null +++ b/docs/models/sdkerrors/updateplayprogressmediaerrors.md @@ -0,0 +1,10 @@ +# UpdatePlayProgressMediaErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/updateplayprogressmediaresponsebody.md b/docs/models/sdkerrors/updateplayprogressmediaresponsebody.md new file mode 100644 index 0000000..2d6903e --- /dev/null +++ b/docs/models/sdkerrors/updateplayprogressmediaresponsebody.md @@ -0,0 +1,11 @@ +# UpdatePlayProgressMediaResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.UpdatePlayProgressMediaErrors](../../models/sdkerrors/updateplayprogressmediaerrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/updateplayprogressresponsebody.md b/docs/models/sdkerrors/updateplayprogressresponsebody.md index d0fae51..6517f94 100644 --- a/docs/models/sdkerrors/updateplayprogressresponsebody.md +++ b/docs/models/sdkerrors/updateplayprogressresponsebody.md @@ -1,6 +1,6 @@ # UpdatePlayProgressResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/models/sdkerrors/uploadplaylisterrors.md b/docs/models/sdkerrors/uploadplaylisterrors.md index 4229b53..1da07b9 100644 --- a/docs/models/sdkerrors/uploadplaylisterrors.md +++ b/docs/models/sdkerrors/uploadplaylisterrors.md @@ -3,8 +3,8 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | -| `Code` | **float64* | :heavy_minus_sign: | N/A | 1001 | -| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | -| `Status` | **float64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1000 | +| `Message` | **string* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/sdkerrors/uploadplaylistplaylistserrors.md b/docs/models/sdkerrors/uploadplaylistplaylistserrors.md new file mode 100644 index 0000000..97b4ff3 --- /dev/null +++ b/docs/models/sdkerrors/uploadplaylistplaylistserrors.md @@ -0,0 +1,10 @@ +# UploadPlaylistPlaylistsErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `Code` | **int64* | :heavy_minus_sign: | N/A | 1001 | +| `Message` | **string* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `Status` | **int64* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/sdkerrors/uploadplaylistplaylistsresponsebody.md b/docs/models/sdkerrors/uploadplaylistplaylistsresponsebody.md new file mode 100644 index 0000000..8f35758 --- /dev/null +++ b/docs/models/sdkerrors/uploadplaylistplaylistsresponsebody.md @@ -0,0 +1,11 @@ +# UploadPlaylistPlaylistsResponseBody + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `Errors` | [][sdkerrors.UploadPlaylistPlaylistsErrors](../../models/sdkerrors/uploadplaylistplaylistserrors.md) | :heavy_minus_sign: | N/A | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/sdkerrors/uploadplaylistresponsebody.md b/docs/models/sdkerrors/uploadplaylistresponsebody.md index 8874f82..b803e46 100644 --- a/docs/models/sdkerrors/uploadplaylistresponsebody.md +++ b/docs/models/sdkerrors/uploadplaylistresponsebody.md @@ -1,6 +1,6 @@ # UploadPlaylistResponseBody -Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +Bad Request - A parameter was not specified, or was specified incorrectly. ## Fields diff --git a/docs/sdks/activities/README.md b/docs/sdks/activities/README.md index ede1c04..3907d0c 100644 --- a/docs/sdks/activities/README.md +++ b/docs/sdks/activities/README.md @@ -35,7 +35,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -51,18 +51,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetServerActivitiesResponse](../../models/operations/getserveractivitiesresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | -| sdkerrors.GetServerActivitiesResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | +| sdkerrors.GetServerActivitiesResponseBody | 400 | application/json | +| sdkerrors.GetServerActivitiesActivitiesResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## CancelServerActivities @@ -82,11 +87,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var activityUUID string = "25b71ed5-0f9d-461c-baa7-d404e9e10d3e" + ctx := context.Background() - res, err := s.Activities.CancelServerActivities(ctx, activityUUID) + res, err := s.Activities.CancelServerActivities(ctx, "25b71ed5-0f9d-461c-baa7-d404e9e10d3e") if err != nil { log.Fatal(err) } @@ -98,16 +103,20 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `activityUUID` | *string* | :heavy_check_mark: | The UUID of the activity to cancel. | 25b71ed5-0f9d-461c-baa7-d404e9e10d3e | - +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `activityUUID` | *string* | :heavy_check_mark: | The UUID of the activity to cancel. | 25b71ed5-0f9d-461c-baa7-d404e9e10d3e | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.CancelServerActivitiesResponse](../../models/operations/cancelserveractivitiesresponse.md), error** -| Error Object | Status Code | Content Type | -| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -| sdkerrors.CancelServerActivitiesResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| sdkerrors.CancelServerActivitiesResponseBody | 400 | application/json | +| sdkerrors.CancelServerActivitiesActivitiesResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/authentication/README.md b/docs/sdks/authentication/README.md index ded362b..7a8f334 100644 --- a/docs/sdks/authentication/README.md +++ b/docs/sdks/authentication/README.md @@ -10,6 +10,8 @@ API Calls regarding authentication for Plex Media Server * [GetTransientToken](#gettransienttoken) - Get a Transient Token. * [GetSourceConnectionInformation](#getsourceconnectioninformation) - Get Source Connection Information +* [GetUserDetails](#getuserdetails) - Get User Data By Token +* [PostUsersSignInData](#postuserssignindata) - Get User Sign In Data ## GetTransientToken @@ -23,21 +25,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var type_ operations.GetTransientTokenQueryParamType = operations.GetTransientTokenQueryParamTypeDelegation - var scope operations.Scope = operations.ScopeAll ctx := context.Background() - res, err := s.Authentication.GetTransientToken(ctx, type_, scope) + res, err := s.Authentication.GetTransientToken(ctx, operations.GetTransientTokenQueryParamTypeDelegation, operations.ScopeAll) if err != nil { log.Fatal(err) } @@ -54,15 +54,20 @@ func main() { | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `type_` | [operations.GetTransientTokenQueryParamType](../../models/operations/gettransienttokenqueryparamtype.md) | :heavy_check_mark: | `delegation` - This is the only supported `type` parameter. | | `scope` | [operations.Scope](../../models/operations/scope.md) | :heavy_check_mark: | `all` - This is the only supported `scope` parameter. | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetTransientTokenResponse](../../models/operations/gettransienttokenresponse.md), error** -| Error Object | Status Code | Content Type | -| --------------------------------------- | --------------------------------------- | --------------------------------------- | -| sdkerrors.GetTransientTokenResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | +| sdkerrors.GetTransientTokenResponseBody | 400 | application/json | +| sdkerrors.GetTransientTokenAuthenticationResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetSourceConnectionInformation @@ -84,11 +89,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var source string = "server://client-identifier" + ctx := context.Background() - res, err := s.Authentication.GetSourceConnectionInformation(ctx, source) + res, err := s.Authentication.GetSourceConnectionInformation(ctx, "server://client-identifier") if err != nil { log.Fatal(err) } @@ -100,16 +105,131 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `source` | *string* | :heavy_check_mark: | The source identifier with an included prefix. | server://client-identifier | - +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `source` | *string* | :heavy_check_mark: | The source identifier with an included prefix. | server://client-identifier | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.GetSourceConnectionInformationResponse](../../models/operations/getsourceconnectioninformationresponse.md), error** -| Error Object | Status Code | Content Type | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| sdkerrors.GetSourceConnectionInformationResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| sdkerrors.GetSourceConnectionInformationResponseBody | 400 | application/json | +| sdkerrors.GetSourceConnectionInformationAuthenticationResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetUserDetails + +Get the User data from the provided X-Plex-Token + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Authentication.GetUserDetails(ctx, "CV5xoxjTpFKUzBTShsaf") + if err != nil { + log.Fatal(err) + } + if res.UserPlexAccount != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `xPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetUserDetailsResponse](../../models/operations/getuserdetailsresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| sdkerrors.GetUserDetailsResponseBody | 400 | application/json | +| sdkerrors.GetUserDetailsAuthenticationResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## PostUsersSignInData + +Sign in user with username and password and return user data with Plex authentication token + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "github.com/LukeHagar/plexgo/models/operations" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Authentication.PostUsersSignInData(ctx, plexgo.String("gcgzw5rz2xovp84b4vha3a40"), &operations.PostUsersSignInDataRequestBody{ + Login: "username@email.com", + Password: "password123", + VerificationCode: plexgo.String("123456"), + }) + if err != nil { + log.Fatal(err) + } + if res.UserPlexAccount != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `xPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | +| `requestBody` | [*operations.PostUsersSignInDataRequestBody](../../models/operations/postuserssignindatarequestbody.md) | :heavy_minus_sign: | Login credentials | | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.PostUsersSignInDataResponse](../../models/operations/postuserssignindataresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| sdkerrors.PostUsersSignInDataResponseBody | 400 | application/json | +| sdkerrors.PostUsersSignInDataAuthenticationResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/butler/README.md b/docs/sdks/butler/README.md index 075caee..6806077 100644 --- a/docs/sdks/butler/README.md +++ b/docs/sdks/butler/README.md @@ -32,7 +32,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -48,18 +48,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetButlerTasksResponse](../../models/operations/getbutlertasksresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | -| sdkerrors.GetButlerTasksResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| sdkerrors.GetButlerTasksResponseBody | 400 | application/json | +| sdkerrors.GetButlerTasksButlerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## StartAllTasks @@ -84,7 +89,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -100,18 +105,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.StartAllTasksResponse](../../models/operations/startalltasksresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | -| sdkerrors.StartAllTasksResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| sdkerrors.StartAllTasksResponseBody | 400 | application/json | +| sdkerrors.StartAllTasksButlerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## StopAllTasks @@ -132,7 +142,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -148,18 +158,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.StopAllTasksResponse](../../models/operations/stopalltasksresponse.md), error** -| Error Object | Status Code | Content Type | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | -| sdkerrors.StopAllTasksResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| sdkerrors.StopAllTasksResponseBody | 400 | application/json | +| sdkerrors.StopAllTasksButlerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## StartTask @@ -177,19 +192,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var taskName operations.TaskName = operations.TaskNameCleanOldBundles + ctx := context.Background() - res, err := s.Butler.StartTask(ctx, taskName) + res, err := s.Butler.StartTask(ctx, operations.TaskNameCleanOldBundles) if err != nil { log.Fatal(err) } @@ -205,15 +220,20 @@ func main() { | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `taskName` | [operations.TaskName](../../models/operations/taskname.md) | :heavy_check_mark: | the name of the task to be started. | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.StartTaskResponse](../../models/operations/starttaskresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------- | ------------------------------- | ------------------------------- | -| sdkerrors.StartTaskResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------- | ------------------------------------- | ------------------------------------- | +| sdkerrors.StartTaskResponseBody | 400 | application/json | +| sdkerrors.StartTaskButlerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## StopTask @@ -227,19 +247,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var taskName operations.PathParamTaskName = operations.PathParamTaskNameBackupDatabase + ctx := context.Background() - res, err := s.Butler.StopTask(ctx, taskName) + res, err := s.Butler.StopTask(ctx, operations.PathParamTaskNameBackupDatabase) if err != nil { log.Fatal(err) } @@ -255,12 +275,16 @@ func main() { | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `taskName` | [operations.PathParamTaskName](../../models/operations/pathparamtaskname.md) | :heavy_check_mark: | The name of the task to be started. | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.StopTaskResponse](../../models/operations/stoptaskresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------ | ------------------------------ | ------------------------------ | -| sdkerrors.StopTaskResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | +| sdkerrors.StopTaskResponseBody | 400 | application/json | +| sdkerrors.StopTaskButlerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/hubs/README.md b/docs/sdks/hubs/README.md index 7eff3b8..4d979d7 100644 --- a/docs/sdks/hubs/README.md +++ b/docs/sdks/hubs/README.md @@ -22,7 +22,6 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" "log" ) @@ -30,13 +29,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var count *float64 = plexgo.Float64(1262.49) - var onlyTransient *operations.OnlyTransient = operations.OnlyTransientOne.ToPointer() ctx := context.Background() - res, err := s.Hubs.GetGlobalHubs(ctx, count, onlyTransient) + res, err := s.Hubs.GetGlobalHubs(ctx, nil, nil) if err != nil { log.Fatal(err) } @@ -53,15 +50,20 @@ func main() { | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `count` | **float64* | :heavy_minus_sign: | The number of items to return with each hub. | | `onlyTransient` | [*operations.OnlyTransient](../../models/operations/onlytransient.md) | :heavy_minus_sign: | Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetGlobalHubsResponse](../../models/operations/getglobalhubsresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | -| sdkerrors.GetGlobalHubsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| sdkerrors.GetGlobalHubsResponseBody | 400 | application/json | +| sdkerrors.GetGlobalHubsHubsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetLibraryHubs @@ -75,7 +77,6 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" "log" ) @@ -83,15 +84,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sectionID float64 = 6728.76 - var count *float64 = plexgo.Float64(9010.22) - - var onlyTransient *operations.QueryParamOnlyTransient = operations.QueryParamOnlyTransientZero.ToPointer() ctx := context.Background() - res, err := s.Hubs.GetLibraryHubs(ctx, sectionID, count, onlyTransient) + res, err := s.Hubs.GetLibraryHubs(ctx, 6728.76, nil, nil) if err != nil { log.Fatal(err) } @@ -109,12 +106,16 @@ func main() { | `sectionID` | *float64* | :heavy_check_mark: | the Id of the library to query | | `count` | **float64* | :heavy_minus_sign: | The number of items to return with each hub. | | `onlyTransient` | [*operations.QueryParamOnlyTransient](../../models/operations/queryparamonlytransient.md) | :heavy_minus_sign: | Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added). | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetLibraryHubsResponse](../../models/operations/getlibraryhubsresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | -| sdkerrors.GetLibraryHubsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| sdkerrors.GetLibraryHubsResponseBody | 400 | application/json | +| sdkerrors.GetLibraryHubsHubsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/library/README.md b/docs/sdks/library/README.md index a63c7cc..726ddf7 100644 --- a/docs/sdks/library/README.md +++ b/docs/sdks/library/README.md @@ -10,13 +10,13 @@ API Calls interacting with Plex Media Server Libraries * [GetFileHash](#getfilehash) - Get Hash Value * [GetRecentlyAdded](#getrecentlyadded) - Get Recently Added -* [GetLibraries](#getlibraries) - Get All Libraries -* [GetLibrary](#getlibrary) - Get Library Details +* [GetAllLibraries](#getalllibraries) - Get All Libraries +* [GetLibraryDetails](#getlibrarydetails) - Get Library Details * [DeleteLibrary](#deletelibrary) - Delete Library Section * [GetLibraryItems](#getlibraryitems) - Get Library Items -* [RefreshLibrary](#refreshlibrary) - Refresh Library -* [SearchLibrary](#searchlibrary) - Search Library -* [GetMetadata](#getmetadata) - Get Items Metadata +* [GetRefreshLibraryMetadata](#getrefreshlibrarymetadata) - Refresh Metadata Of The Library +* [GetSearchLibrary](#getsearchlibrary) - Search Library +* [GetMetaDataByRatingKey](#getmetadatabyratingkey) - Get Metadata by RatingKey * [GetMetadataChildren](#getmetadatachildren) - Get Items Children * [GetTopWatchedContent](#gettopwatchedcontent) - Get Top Watched Content * [GetOnDeck](#getondeck) - Get On Deck @@ -39,13 +39,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var url_ string = "file://C:\Image.png&type=13" - var type_ *float64 = plexgo.Float64(4462.17) ctx := context.Background() - res, err := s.Library.GetFileHash(ctx, url_, type_) + res, err := s.Library.GetFileHash(ctx, "file://C:\Image.png&type=13", nil) if err != nil { log.Fatal(err) } @@ -62,15 +60,20 @@ func main() { | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | | `url_` | *string* | :heavy_check_mark: | This is the path to the local file, must be prefixed by `file://` | file://C:\Image.png&type=13 | | `type_` | **float64* | :heavy_minus_sign: | Item type | | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.GetFileHashResponse](../../models/operations/getfilehashresponse.md), error** -| Error Object | Status Code | Content Type | -| --------------------------------- | --------------------------------- | --------------------------------- | -| sdkerrors.GetFileHashResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| sdkerrors.GetFileHashResponseBody | 400 | application/json | +| sdkerrors.GetFileHashLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetRecentlyAdded @@ -91,11 +94,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() - res, err := s.Library.GetRecentlyAdded(ctx) + res, err := s.Library.GetRecentlyAdded(ctx, plexgo.Int(0), plexgo.Int(50)) if err != nil { log.Fatal(err) } @@ -107,20 +110,27 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `xPlexContainerStart` | **int* | :heavy_minus_sign: | The index of the first item to return. If not specified, the first item will be returned.
If the number of items exceeds the limit, the response will be paginated.
By default this is 0
| 0 | +| `xPlexContainerSize` | **int* | :heavy_minus_sign: | The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
By default this is 50
| 50 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.GetRecentlyAddedResponse](../../models/operations/getrecentlyaddedresponse.md), error** -| Error Object | Status Code | Content Type | -| -------------------------------------- | -------------------------------------- | -------------------------------------- | -| sdkerrors.GetRecentlyAddedResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | -## GetLibraries +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| sdkerrors.GetRecentlyAddedResponseBody | 400 | application/json | +| sdkerrors.GetRecentlyAddedLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetAllLibraries A library section (commonly referred to as just a library) is a collection of media. Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media. @@ -144,11 +154,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() - res, err := s.Library.GetLibraries(ctx) + res, err := s.Library.GetAllLibraries(ctx) if err != nil { log.Fatal(err) } @@ -160,20 +170,25 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response -**[*operations.GetLibrariesResponse](../../models/operations/getlibrariesresponse.md), error** -| Error Object | Status Code | Content Type | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | -| sdkerrors.GetLibrariesResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +**[*operations.GetAllLibrariesResponse](../../models/operations/getalllibrariesresponse.md), error** -## GetLibrary +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| sdkerrors.GetAllLibrariesResponseBody | 400 | application/json | +| sdkerrors.GetAllLibrariesLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetLibraryDetails ## Library Details Endpoint @@ -223,7 +238,6 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" "log" ) @@ -231,13 +245,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sectionID float64 = 1000 - var includeDetails *operations.IncludeDetails = operations.IncludeDetailsZero.ToPointer() ctx := context.Background() - res, err := s.Library.GetLibrary(ctx, sectionID, includeDetails) + res, err := s.Library.GetLibraryDetails(ctx, 9518, nil) if err != nil { log.Fatal(err) } @@ -252,21 +264,26 @@ 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. | | -| `sectionID` | *float64* | :heavy_check_mark: | the Id of the library to query | 1000 | +| `sectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | | `includeDetails` | [*operations.IncludeDetails](../../models/operations/includedetails.md) | :heavy_minus_sign: | Whether or not to include details for a section (types, filters, and sorts).
Only exists for backwards compatibility, media providers other than the server libraries have it on always.
| | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response -**[*operations.GetLibraryResponse](../../models/operations/getlibraryresponse.md), error** -| Error Object | Status Code | Content Type | -| -------------------------------- | -------------------------------- | -------------------------------- | -| sdkerrors.GetLibraryResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +**[*operations.GetLibraryDetailsResponse](../../models/operations/getlibrarydetailsresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | +| sdkerrors.GetLibraryDetailsResponseBody | 400 | application/json | +| sdkerrors.GetLibraryDetailsLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## DeleteLibrary -Delate a library using a specific section +Delete a library using a specific section id ### Example Usage @@ -282,11 +299,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sectionID float64 = 1000 + ctx := context.Background() - res, err := s.Library.DeleteLibrary(ctx, sectionID) + res, err := s.Library.DeleteLibrary(ctx, 9518) if err != nil { log.Fatal(err) } @@ -298,19 +315,24 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `sectionID` | *float64* | :heavy_check_mark: | the Id of the library to query | 1000 | - +| Parameter | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `sectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.DeleteLibraryResponse](../../models/operations/deletelibraryresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | -| sdkerrors.DeleteLibraryResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| sdkerrors.DeleteLibraryResponseBody | 400 | application/json | +| sdkerrors.DeleteLibraryLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetLibraryItems @@ -343,23 +365,27 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sectionID any = "" - var tag operations.Tag = operations.TagGenre - - var includeGuids *int64 = plexgo.Int64(1) ctx := context.Background() - res, err := s.Library.GetLibraryItems(ctx, sectionID, tag, includeGuids) + res, err := s.Library.GetLibraryItems(ctx, operations.GetLibraryItemsRequest{ + SectionKey: 9518, + Tag: operations.TagEdition, + IncludeGuids: operations.IncludeGuidsOne.ToPointer(), + IncludeMeta: operations.IncludeMetaOne.ToPointer(), + Type: operations.TypeTwo, + XPlexContainerStart: plexgo.Int(0), + XPlexContainerSize: plexgo.Int(50), + }) if err != nil { log.Fatal(err) } @@ -371,25 +397,28 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `sectionID` | *any* | :heavy_check_mark: | the Id of the library to query | | -| `tag` | [operations.Tag](../../models/operations/tag.md) | :heavy_check_mark: | A key representing a specific tag within the section. | | -| `includeGuids` | **int64* | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.GetLibraryItemsRequest](../../models/operations/getlibraryitemsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetLibraryItemsResponse](../../models/operations/getlibraryitemsresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------- | ------------------------------------- | ------------------------------------- | -| sdkerrors.GetLibraryItemsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | -## RefreshLibrary +### Errors -This endpoint Refreshes the library. +| Error Object | Status Code | Content Type | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| sdkerrors.GetLibraryItemsResponseBody | 400 | application/json | +| sdkerrors.GetLibraryItemsLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetRefreshLibraryMetadata + +This endpoint Refreshes all the Metadata of the library. ### Example Usage @@ -400,17 +429,18 @@ package main import( "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sectionID float64 = 934.16 + ctx := context.Background() - res, err := s.Library.RefreshLibrary(ctx, sectionID) + res, err := s.Library.GetRefreshLibraryMetadata(ctx, 9518, operations.ForceOne.ToPointer()) if err != nil { log.Fatal(err) } @@ -422,21 +452,27 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `sectionID` | *float64* | :heavy_check_mark: | the Id of the library to refresh | - +| Parameter | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `sectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | +| `force` | [*operations.Force](../../models/operations/force.md) | :heavy_minus_sign: | Force the refresh even if the library is already being refreshed. | 0 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response -**[*operations.RefreshLibraryResponse](../../models/operations/refreshlibraryresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | -| sdkerrors.RefreshLibraryResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +**[*operations.GetRefreshLibraryMetadataResponse](../../models/operations/getrefreshlibrarymetadataresponse.md), error** -## SearchLibrary +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| sdkerrors.GetRefreshLibraryMetadataResponseBody | 400 | application/json | +| sdkerrors.GetRefreshLibraryMetadataLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetSearchLibrary Search for content within a specific section of the library. @@ -465,21 +501,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sectionID int64 = 933505 - var type_ operations.Type = operations.TypeFour ctx := context.Background() - res, err := s.Library.SearchLibrary(ctx, sectionID, type_) + res, err := s.Library.GetSearchLibrary(ctx, 9518, operations.QueryParamTypeTwo) if err != nil { log.Fatal(err) } @@ -491,22 +525,27 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `sectionID` | *int64* | :heavy_check_mark: | the Id of the library to query | -| `type_` | [operations.Type](../../models/operations/type.md) | :heavy_check_mark: | Plex content type to search for | - +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `sectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | +| `type_` | [operations.QueryParamType](../../models/operations/queryparamtype.md) | :heavy_check_mark: | The type of media to retrieve.
1 = movie
2 = show
3 = season
4 = episode
E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
| 2 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response -**[*operations.SearchLibraryResponse](../../models/operations/searchlibraryresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | -| sdkerrors.SearchLibraryResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +**[*operations.GetSearchLibraryResponse](../../models/operations/getsearchlibraryresponse.md), error** -## GetMetadata +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| sdkerrors.GetSearchLibraryResponseBody | 400 | application/json | +| sdkerrors.GetSearchLibraryLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetMetaDataByRatingKey This endpoint will return the metadata of a library item specified with the ratingKey. @@ -525,11 +564,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var ratingKey float64 = 8382.31 + ctx := context.Background() - res, err := s.Library.GetMetadata(ctx, ratingKey) + res, err := s.Library.GetMetaDataByRatingKey(ctx, 9518) if err != nil { log.Fatal(err) } @@ -541,19 +580,24 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `ratingKey` | *float64* | :heavy_check_mark: | the id of the library item to return the children of. | - +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `ratingKey` | *int64* | :heavy_check_mark: | the id of the library item to return the children of. | 9518 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response -**[*operations.GetMetadataResponse](../../models/operations/getmetadataresponse.md), error** -| Error Object | Status Code | Content Type | -| --------------------------------- | --------------------------------- | --------------------------------- | -| sdkerrors.GetMetadataResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +**[*operations.GetMetaDataByRatingKeyResponse](../../models/operations/getmetadatabyratingkeyresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | +| sdkerrors.GetMetaDataByRatingKeyResponseBody | 400 | application/json | +| sdkerrors.GetMetaDataByRatingKeyLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetMetadataChildren @@ -574,13 +618,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var ratingKey float64 = 1539.14 - var includeElements *string = plexgo.String("") ctx := context.Background() - res, err := s.Library.GetMetadataChildren(ctx, ratingKey, includeElements) + res, err := s.Library.GetMetadataChildren(ctx, 1539.14, plexgo.String("Stream")) if err != nil { log.Fatal(err) } @@ -597,15 +639,20 @@ func main() { | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `ratingKey` | *float64* | :heavy_check_mark: | the id of the library item to return the children of. | | `includeElements` | **string* | :heavy_minus_sign: | Adds additional elements to the response. Supported types are (Stream)
| - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetMetadataChildrenResponse](../../models/operations/getmetadatachildrenresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | -| sdkerrors.GetMetadataChildrenResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| sdkerrors.GetMetadataChildrenResponseBody | 400 | application/json | +| sdkerrors.GetMetadataChildrenLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetTopWatchedContent @@ -620,19 +667,18 @@ package main import( "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var type_ int64 = 505531 - var includeGuids *int64 = plexgo.Int64(1) ctx := context.Background() - res, err := s.Library.GetTopWatchedContent(ctx, type_, includeGuids) + res, err := s.Library.GetTopWatchedContent(ctx, operations.GetTopWatchedContentQueryParamTypeTwo, plexgo.Int64(1)) if err != nil { log.Fatal(err) } @@ -644,19 +690,25 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `type_` | *int64* | :heavy_check_mark: | the library type (1 - movies, 2 - shows, 3 - music) | | -| `includeGuids` | **int64* | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | - +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `type_` | [operations.GetTopWatchedContentQueryParamType](../../models/operations/gettopwatchedcontentqueryparamtype.md) | :heavy_check_mark: | The type of media to retrieve.
1 = movie
2 = show
3 = season
4 = episode
E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
| 2 | +| `includeGuids` | **int64* | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.GetTopWatchedContentResponse](../../models/operations/gettopwatchedcontentresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| sdkerrors.GetTopWatchedContentResponseBody | 400 | application/json | +| sdkerrors.GetTopWatchedContentLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetOnDeck @@ -677,7 +729,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -693,15 +745,19 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetOnDeckResponse](../../models/operations/getondeckresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------- | ------------------------------- | ------------------------------- | -| sdkerrors.GetOnDeckResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| sdkerrors.GetOnDeckResponseBody | 400 | application/json | +| sdkerrors.GetOnDeckLibraryResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/log/README.md b/docs/sdks/log/README.md index 1a65e53..a627493 100644 --- a/docs/sdks/log/README.md +++ b/docs/sdks/log/README.md @@ -24,23 +24,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var level operations.Level = operations.LevelThree - var message string = "Test log message" - - var source string = "Postman" ctx := context.Background() - res, err := s.Log.LogLine(ctx, level, message, source) + res, err := s.Log.LogLine(ctx, operations.LevelThree, "Test log message", "Postman") if err != nil { log.Fatal(err) } @@ -58,15 +54,20 @@ func main() { | `level` | [operations.Level](../../models/operations/level.md) | :heavy_check_mark: | An integer log level to write to the PMS log with.
0: Error
1: Warning
2: Info
3: Debug
4: Verbose
| | | `message` | *string* | :heavy_check_mark: | The text of the message to write to the log. | Test log message | | `source` | *string* | :heavy_check_mark: | a string indicating the source of the message. | Postman | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.LogLineResponse](../../models/operations/loglineresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------- | ----------------------------- | ----------------------------- | -| sdkerrors.LogLineResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------- | -------------------------------- | -------------------------------- | +| sdkerrors.LogLineResponseBody | 400 | application/json | +| sdkerrors.LogLineLogResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## LogMultiLine @@ -107,13 +108,13 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var request string = "level=4&message=Test%20message%201&source=postman -level=3&message=Test%20message%202&source=postman -level=1&message=Test%20message%203&source=postman" + ctx := context.Background() - res, err := s.Log.LogMultiLine(ctx, request) + 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) } @@ -125,19 +126,24 @@ level=1&message=Test%20message%203&source=postman" ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `request` | [string](../../.md) | :heavy_check_mark: | The request object to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [string](../../.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.LogMultiLineResponse](../../models/operations/logmultilineresponse.md), error** -| Error Object | Status Code | Content Type | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | -| sdkerrors.LogMultiLineResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------- | ------------------------------------- | ------------------------------------- | +| sdkerrors.LogMultiLineResponseBody | 400 | application/json | +| sdkerrors.LogMultiLineLogResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## EnablePaperTrail @@ -158,7 +164,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -174,15 +180,19 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.EnablePaperTrailResponse](../../models/operations/enablepapertrailresponse.md), error** -| Error Object | Status Code | Content Type | -| -------------------------------------- | -------------------------------------- | -------------------------------------- | -| sdkerrors.EnablePaperTrailResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| sdkerrors.EnablePaperTrailResponseBody | 400 | application/json | +| sdkerrors.EnablePaperTrailLogResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/media/README.md b/docs/sdks/media/README.md index 9c9dfdc..c740b04 100644 --- a/docs/sdks/media/README.md +++ b/docs/sdks/media/README.md @@ -11,6 +11,8 @@ API Calls interacting with Plex Media Server Media * [MarkPlayed](#markplayed) - Mark Media Played * [MarkUnplayed](#markunplayed) - Mark Media Unplayed * [UpdatePlayProgress](#updateplayprogress) - Update Media Play Progress +* [GetBannerImage](#getbannerimage) - Get Banner Image +* [GetThumbImage](#getthumbimage) - Get Thumb Image ## MarkPlayed @@ -30,11 +32,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var key float64 = 59398 + ctx := context.Background() - res, err := s.Media.MarkPlayed(ctx, key) + res, err := s.Media.MarkPlayed(ctx, 59398) if err != nil { log.Fatal(err) } @@ -46,19 +48,24 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `key` | *float64* | :heavy_check_mark: | The media key to mark as played | 59398 | - +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `key` | *float64* | :heavy_check_mark: | The media key to mark as played | 59398 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.MarkPlayedResponse](../../models/operations/markplayedresponse.md), error** -| Error Object | Status Code | Content Type | -| -------------------------------- | -------------------------------- | -------------------------------- | -| sdkerrors.MarkPlayedResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------- | ------------------------------------- | ------------------------------------- | +| sdkerrors.MarkPlayedResponseBody | 400 | application/json | +| sdkerrors.MarkPlayedMediaResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## MarkUnplayed @@ -78,11 +85,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var key float64 = 59398 + ctx := context.Background() - res, err := s.Media.MarkUnplayed(ctx, key) + res, err := s.Media.MarkUnplayed(ctx, 59398) if err != nil { log.Fatal(err) } @@ -94,19 +101,24 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `key` | *float64* | :heavy_check_mark: | The media key to mark as Unplayed | 59398 | - +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `key` | *float64* | :heavy_check_mark: | The media key to mark as Unplayed | 59398 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.MarkUnplayedResponse](../../models/operations/markunplayedresponse.md), error** -| Error Object | Status Code | Content Type | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | -| sdkerrors.MarkUnplayedResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------- | --------------------------------------- | --------------------------------------- | +| sdkerrors.MarkUnplayedResponseBody | 400 | application/json | +| sdkerrors.MarkUnplayedMediaResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## UpdatePlayProgress @@ -127,15 +139,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var key string = "" - var time float64 = 90000 - - var state string = "played" ctx := context.Background() - res, err := s.Media.UpdatePlayProgress(ctx, key, time, state) + res, err := s.Media.UpdatePlayProgress(ctx, "", 90000, "played") if err != nil { log.Fatal(err) } @@ -153,12 +161,138 @@ func main() { | `key` | *string* | :heavy_check_mark: | the media key | | | `time` | *float64* | :heavy_check_mark: | The time, in milliseconds, used to set the media playback progress. | 90000 | | `state` | *string* | :heavy_check_mark: | The playback state of the media item. | played | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.UpdatePlayProgressResponse](../../models/operations/updateplayprogressresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| sdkerrors.UpdatePlayProgressResponseBody | 400 | application/json | +| sdkerrors.UpdatePlayProgressMediaResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetBannerImage + +Gets the banner image of the media item + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "github.com/LukeHagar/plexgo/models/operations" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.GetBannerImageRequest](../../models/operations/getbannerimagerequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetBannerImageResponse](../../models/operations/getbannerimageresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| sdkerrors.GetBannerImageResponseBody | 400 | application/json | +| sdkerrors.GetBannerImageMediaResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetThumbImage + +Gets the thumbnail image of the media item + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "github.com/LukeHagar/plexgo/models/operations" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + 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 + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.GetThumbImageRequest](../../models/operations/getthumbimagerequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetThumbImageResponse](../../models/operations/getthumbimageresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| sdkerrors.UpdatePlayProgressResponseBody | 401 | application/json | +| sdkerrors.GetThumbImageResponseBody | 400 | application/json | +| sdkerrors.GetThumbImageMediaResponseBody | 401 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/playlists/README.md b/docs/sdks/playlists/README.md index fa53296..74df16b 100644 --- a/docs/sdks/playlists/README.md +++ b/docs/sdks/playlists/README.md @@ -35,24 +35,24 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - request := operations.CreatePlaylistRequest{ + + ctx := context.Background() + res, err := s.Playlists.CreatePlaylist(ctx, operations.CreatePlaylistRequest{ Title: "", - Type: operations.QueryParamTypePhoto, + Type: operations.CreatePlaylistQueryParamTypePhoto, Smart: operations.SmartOne, URI: "https://inborn-brochure.biz", - } - ctx := context.Background() - res, err := s.Playlists.CreatePlaylist(ctx, request) + }) if err != nil { log.Fatal(err) } @@ -68,15 +68,20 @@ func main() { | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `request` | [operations.CreatePlaylistRequest](../../models/operations/createplaylistrequest.md) | :heavy_check_mark: | The request object to use for the request. | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.CreatePlaylistResponse](../../models/operations/createplaylistresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | -| sdkerrors.CreatePlaylistResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| sdkerrors.CreatePlaylistResponseBody | 400 | application/json | +| sdkerrors.CreatePlaylistPlaylistsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetPlaylists @@ -89,7 +94,6 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" "log" ) @@ -97,13 +101,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var playlistType *operations.PlaylistType = operations.PlaylistTypeAudio.ToPointer() - var smart *operations.QueryParamSmart = operations.QueryParamSmartZero.ToPointer() ctx := context.Background() - res, err := s.Playlists.GetPlaylists(ctx, playlistType, smart) + res, err := s.Playlists.GetPlaylists(ctx, nil, nil) if err != nil { log.Fatal(err) } @@ -120,15 +122,20 @@ func main() { | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `playlistType` | [*operations.PlaylistType](../../models/operations/playlisttype.md) | :heavy_minus_sign: | limit to a type of playlist. | | `smart` | [*operations.QueryParamSmart](../../models/operations/queryparamsmart.md) | :heavy_minus_sign: | type of playlists to return (default is all). | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetPlaylistsResponse](../../models/operations/getplaylistsresponse.md), error** -| Error Object | Status Code | Content Type | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | -| sdkerrors.GetPlaylistsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| sdkerrors.GetPlaylistsResponseBody | 400 | application/json | +| sdkerrors.GetPlaylistsPlaylistsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetPlaylist @@ -150,11 +157,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var playlistID float64 = 4109.48 + ctx := context.Background() - res, err := s.Playlists.GetPlaylist(ctx, playlistID) + res, err := s.Playlists.GetPlaylist(ctx, 4109.48) if err != nil { log.Fatal(err) } @@ -166,19 +173,24 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetPlaylistResponse](../../models/operations/getplaylistresponse.md), error** -| Error Object | Status Code | Content Type | -| --------------------------------- | --------------------------------- | --------------------------------- | -| sdkerrors.GetPlaylistResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | +| sdkerrors.GetPlaylistResponseBody | 400 | application/json | +| sdkerrors.GetPlaylistPlaylistsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## DeletePlaylist @@ -199,11 +211,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var playlistID float64 = 216.22 + ctx := context.Background() - res, err := s.Playlists.DeletePlaylist(ctx, playlistID) + res, err := s.Playlists.DeletePlaylist(ctx, 216.22) if err != nil { log.Fatal(err) } @@ -215,19 +227,24 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.DeletePlaylistResponse](../../models/operations/deleteplaylistresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | -| sdkerrors.DeletePlaylistResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| sdkerrors.DeletePlaylistResponseBody | 400 | application/json | +| sdkerrors.DeletePlaylistPlaylistsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## UpdatePlaylist @@ -248,15 +265,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var playlistID float64 = 3915 - var title *string = plexgo.String("") - - var summary *string = plexgo.String("") ctx := context.Background() - res, err := s.Playlists.UpdatePlaylist(ctx, playlistID, title, summary) + res, err := s.Playlists.UpdatePlaylist(ctx, 3915, nil, nil) if err != nil { log.Fatal(err) } @@ -268,21 +281,26 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | -| `title` | **string* | :heavy_minus_sign: | name of the playlist | -| `summary` | **string* | :heavy_minus_sign: | summary description of the playlist | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | +| `title` | **string* | :heavy_minus_sign: | name of the playlist | +| `summary` | **string* | :heavy_minus_sign: | summary description of the playlist | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.UpdatePlaylistResponse](../../models/operations/updateplaylistresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | -| sdkerrors.UpdatePlaylistResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| sdkerrors.UpdatePlaylistResponseBody | 400 | application/json | +| sdkerrors.UpdatePlaylistPlaylistsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetPlaylistContents @@ -300,19 +318,18 @@ package main import( "github.com/LukeHagar/plexgo" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var playlistID float64 = 5004.46 - var type_ float64 = 9403.59 ctx := context.Background() - res, err := s.Playlists.GetPlaylistContents(ctx, playlistID, type_) + res, err := s.Playlists.GetPlaylistContents(ctx, 5004.46, operations.GetPlaylistContentsQueryParamTypeTwo) if err != nil { log.Fatal(err) } @@ -324,20 +341,25 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | -| `type_` | *float64* | :heavy_check_mark: | the metadata type of the item to return | - +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | | +| `type_` | [operations.GetPlaylistContentsQueryParamType](../../models/operations/getplaylistcontentsqueryparamtype.md) | :heavy_check_mark: | The type of media to retrieve.
1 = movie
2 = show
3 = season
4 = episode
E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
| 2 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.GetPlaylistContentsResponse](../../models/operations/getplaylistcontentsresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | -| sdkerrors.GetPlaylistContentsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| sdkerrors.GetPlaylistContentsResponseBody | 400 | application/json | +| sdkerrors.GetPlaylistContentsPlaylistsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ClearPlaylistContents @@ -358,11 +380,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var playlistID float64 = 1893.18 + ctx := context.Background() - res, err := s.Playlists.ClearPlaylistContents(ctx, playlistID) + res, err := s.Playlists.ClearPlaylistContents(ctx, 1893.18) if err != nil { log.Fatal(err) } @@ -374,19 +396,24 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.ClearPlaylistContentsResponse](../../models/operations/clearplaylistcontentsresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | -| sdkerrors.ClearPlaylistContentsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | +| sdkerrors.ClearPlaylistContentsResponseBody | 400 | application/json | +| sdkerrors.ClearPlaylistContentsPlaylistsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## AddPlaylistContents @@ -408,15 +435,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var playlistID float64 = 8502.01 - var uri string = "server://12345/com.plexapp.plugins.library/library/metadata/1" - - var playQueueID *float64 = plexgo.Float64(123) ctx := context.Background() - res, err := s.Playlists.AddPlaylistContents(ctx, playlistID, uri, playQueueID) + 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) } @@ -434,15 +457,20 @@ func main() { | `playlistID` | *float64* | :heavy_check_mark: | the ID of the playlist | | | `uri` | *string* | :heavy_check_mark: | the content URI for the playlist | server://12345/com.plexapp.plugins.library/library/metadata/1 | | `playQueueID` | **float64* | :heavy_minus_sign: | the play queue to add to a playlist | 123 | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.AddPlaylistContentsResponse](../../models/operations/addplaylistcontentsresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | -| sdkerrors.AddPlaylistContentsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| sdkerrors.AddPlaylistContentsResponseBody | 400 | application/json | +| sdkerrors.AddPlaylistContentsPlaylistsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## UploadPlaylist @@ -456,21 +484,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var path string = "/home/barkley/playlist.m3u" - var force operations.Force = operations.ForceZero ctx := context.Background() - res, err := s.Playlists.UploadPlaylist(ctx, path, force) + res, err := s.Playlists.UploadPlaylist(ctx, "/home/barkley/playlist.m3u", operations.QueryParamForceZero) if err != nil { log.Fatal(err) } @@ -486,13 +512,17 @@ func main() { | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | | `path` | *string* | :heavy_check_mark: | absolute path to a directory on the server where m3u files are stored, or the absolute path to a playlist file on the server.
If the `path` argument is a directory, that path will be scanned for playlist files to be processed.
Each file in that directory creates a separate playlist, with a name based on the filename of the file that created it.
The GUID of each playlist is based on the filename.
If the `path` argument is a file, that file will be used to create a new playlist, with the name based on the filename of the file that created it.
The GUID of each playlist is based on the filename.
| /home/barkley/playlist.m3u | -| `force` | [operations.Force](../../models/operations/force.md) | :heavy_check_mark: | Force overwriting of duplicate playlists.
By default, a playlist file uploaded with the same path will overwrite the existing playlist.
The `force` argument is used to disable overwriting.
If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
| | - +| `force` | [operations.QueryParamForce](../../models/operations/queryparamforce.md) | :heavy_check_mark: | Force overwriting of duplicate playlists.
By default, a playlist file uploaded with the same path will overwrite the existing playlist.
The `force` argument is used to disable overwriting.
If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
| | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.UploadPlaylistResponse](../../models/operations/uploadplaylistresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------ | ------------------------------------ | ------------------------------------ | -| sdkerrors.UploadPlaylistResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| sdkerrors.UploadPlaylistResponseBody | 400 | application/json | +| sdkerrors.UploadPlaylistPlaylistsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/plex/README.md b/docs/sdks/plex/README.md index 9ea7596..7482901 100644 --- a/docs/sdks/plex/README.md +++ b/docs/sdks/plex/README.md @@ -8,9 +8,168 @@ API Calls that perform operations directly against https://Plex.tv ### Available Operations +* [GetCompanionsData](#getcompanionsdata) - Get Companions Data +* [GetUserFriends](#getuserfriends) - Get list of friends of the user logged in +* [GetGeoData](#getgeodata) - Get Geo Data * [GetHomeData](#gethomedata) - Get Plex Home Data +* [GetServerResources](#getserverresources) - Get Server Resources * [GetPin](#getpin) - Get a Pin -* [GetToken](#gettoken) - Get Access Token +* [GetTokenByPinID](#gettokenbypinid) - Get Access Token by PinId + +## GetCompanionsData + +Get Companions Data + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Plex.GetCompanionsData(ctx) + if err != nil { + log.Fatal(err) + } + if res.ResponseBodies != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetCompanionsDataResponse](../../models/operations/getcompanionsdataresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| sdkerrors.GetCompanionsDataResponseBody | 400 | application/json | +| sdkerrors.GetCompanionsDataPlexResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetUserFriends + +Get friends of provided auth token. + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Plex.GetUserFriends(ctx) + if err != nil { + log.Fatal(err) + } + if res.Friends != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetUserFriendsResponse](../../models/operations/getuserfriendsresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | +| sdkerrors.GetUserFriendsResponseBody | 400 | application/json | +| sdkerrors.GetUserFriendsPlexResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetGeoData + +Returns the geolocation and locale data of the caller + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Plex.GetGeoData(ctx) + if err != nil { + log.Fatal(err) + } + if res.GeoData != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetGeoDataResponse](../../models/operations/getgeodataresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------ | ------------------------------------ | ------------------------------------ | +| sdkerrors.GetGeoDataResponseBody | 400 | application/json | +| sdkerrors.GetGeoDataPlexResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetHomeData @@ -30,7 +189,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -46,18 +205,82 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetHomeDataResponse](../../models/operations/gethomedataresponse.md), error** -| Error Object | Status Code | Content Type | -| --------------------------------- | --------------------------------- | --------------------------------- | -| sdkerrors.GetHomeDataResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------- | ------------------------------------- | ------------------------------------- | +| sdkerrors.GetHomeDataResponseBody | 400 | application/json | +| sdkerrors.GetHomeDataPlexResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetServerResources + +Get Plex server access tokens and server connections + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "github.com/LukeHagar/plexgo/models/operations" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Plex.GetServerResources(ctx, operations.GetServerResourcesRequest{ + XPlexToken: "CV5xoxjTpFKUzBTShsaf", + IncludeHTTPS: operations.IncludeHTTPSOne.ToPointer(), + IncludeRelay: operations.IncludeRelayOne.ToPointer(), + IncludeIPv6: operations.IncludeIPv6One.ToPointer(), + }) + if err != nil { + log.Fatal(err) + } + if res.PlexDevices != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.GetServerResourcesRequest](../../models/operations/getserverresourcesrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GetServerResourcesResponse](../../models/operations/getserverresourcesresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| sdkerrors.GetServerResourcesResponseBody | 400 | application/json | +| sdkerrors.GetServerResourcesPlexResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetPin @@ -76,19 +299,15 @@ import( func main() { s := plexgo.New( - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var xPlexProduct string = "Postman" - var strong *bool = plexgo.Bool(false) - - var xPlexClientIdentifier *string = plexgo.String("Postman") ctx := context.Background() - res, err := s.Plex.GetPin(ctx, xPlexProduct, strong, xPlexClientIdentifier) + res, err := s.Plex.GetPin(ctx, nil, plexgo.String("gcgzw5rz2xovp84b4vha3a40"), plexgo.String("Plex Web")) if err != nil { log.Fatal(err) } - if res.Object != nil { + if res.AuthPinContainer != nil { // handle response } } @@ -99,23 +318,26 @@ 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. | | -| `xPlexProduct` | *string* | :heavy_check_mark: | Product name of the application shown in the list of devices
| Postman | | `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`
| | -| `xPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | +| `xPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | +| `xPlexProduct` | **string* | :heavy_minus_sign: | N/A | Plex Web | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | - ### Response **[*operations.GetPinResponse](../../models/operations/getpinresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | ---------------------------- | ---------------------------- | ---------------------------- | | sdkerrors.GetPinResponseBody | 400 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | -## GetToken -Retrieve an Access Token from Plex.tv after the Pin has already been authenticated +## GetTokenByPinID + +Retrieve an Access Token from Plex.tv after the Pin has been authenticated ### Example Usage @@ -130,17 +352,15 @@ import( func main() { s := plexgo.New( - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var pinID string = "" - var xPlexClientIdentifier *string = plexgo.String("Postman") ctx := context.Background() - res, err := s.Plex.GetToken(ctx, pinID, xPlexClientIdentifier) + res, err := s.Plex.GetTokenByPinID(ctx, 408895, plexgo.String("gcgzw5rz2xovp84b4vha3a40")) if err != nil { log.Fatal(err) } - if res.Object != nil { + if res.AuthPinContainer != nil { // handle response } } @@ -151,15 +371,18 @@ 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. | | -| `pinID` | *string* | :heavy_check_mark: | The PinID to retrieve an access token for | | -| `xPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| Postman | +| `pinID` | *int64* | :heavy_check_mark: | The PinID to retrieve an access token for | | +| `xPlexClientIdentifier` | **string* | :heavy_minus_sign: | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
| gcgzw5rz2xovp84b4vha3a40 | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | - ### Response -**[*operations.GetTokenResponse](../../models/operations/gettokenresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------ | ------------------------------ | ------------------------------ | -| sdkerrors.GetTokenResponseBody | 400 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +**[*operations.GetTokenByPinIDResponse](../../models/operations/gettokenbypinidresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| sdkerrors.GetTokenByPinIDResponseBody | 400 | application/json | +| sdkerrors.GetTokenByPinIDPlexResponseBody | 404 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/plexapi/README.md b/docs/sdks/plexapi/README.md index 8ee580c..2fd26ab 100644 --- a/docs/sdks/plexapi/README.md +++ b/docs/sdks/plexapi/README.md @@ -1,9 +1,5 @@ # PlexAPI SDK - ## Overview -An Open API Spec for interacting with Plex.tv and Plex Servers - -### Available Operations - +Plex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server \ No newline at end of file diff --git a/docs/sdks/search/README.md b/docs/sdks/search/README.md index 0805889..d1355cd 100644 --- a/docs/sdks/search/README.md +++ b/docs/sdks/search/README.md @@ -42,15 +42,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var query string = "dylan" - var sectionID *float64 = plexgo.Float64(1516.53) - - var limit *float64 = plexgo.Float64(5) ctx := context.Background() - res, err := s.Search.PerformSearch(ctx, query, sectionID, limit) + res, err := s.Search.PerformSearch(ctx, "dylan", nil, plexgo.Float64(5)) if err != nil { log.Fatal(err) } @@ -68,15 +64,20 @@ func main() { | `query` | *string* | :heavy_check_mark: | The query term | arnold | | `sectionID` | **float64* | :heavy_minus_sign: | This gives context to the search, and can result in re-ordering of search result hubs | | | `limit` | **float64* | :heavy_minus_sign: | The number of items to return per hub | 5 | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.PerformSearchResponse](../../models/operations/performsearchresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | -| sdkerrors.PerformSearchResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| sdkerrors.PerformSearchResponseBody | 400 | application/json | +| sdkerrors.PerformSearchSearchResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## PerformVoiceSearch @@ -100,15 +101,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var query string = "dead+poop" - var sectionID *float64 = plexgo.Float64(4094.8) - - var limit *float64 = plexgo.Float64(5) ctx := context.Background() - res, err := s.Search.PerformVoiceSearch(ctx, query, sectionID, limit) + res, err := s.Search.PerformVoiceSearch(ctx, "dead+poop", nil, plexgo.Float64(5)) if err != nil { log.Fatal(err) } @@ -126,15 +123,20 @@ func main() { | `query` | *string* | :heavy_check_mark: | The query term | dead+poop | | `sectionID` | **float64* | :heavy_minus_sign: | This gives context to the search, and can result in re-ordering of search result hubs | | | `limit` | **float64* | :heavy_minus_sign: | The number of items to return per hub | 5 | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.PerformVoiceSearchResponse](../../models/operations/performvoicesearchresponse.md), error** -| Error Object | Status Code | Content Type | -| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| sdkerrors.PerformVoiceSearchResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | +| sdkerrors.PerformVoiceSearchResponseBody | 400 | application/json | +| sdkerrors.PerformVoiceSearchSearchResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetSearchResults @@ -154,11 +156,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var query string = "110" + ctx := context.Background() - res, err := s.Search.GetSearchResults(ctx, query) + res, err := s.Search.GetSearchResults(ctx, "110") if err != nil { log.Fatal(err) } @@ -170,16 +172,20 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `query` | *string* | :heavy_check_mark: | The search query string to use | 110 | - +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `query` | *string* | :heavy_check_mark: | The search query string to use | 110 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.GetSearchResultsResponse](../../models/operations/getsearchresultsresponse.md), error** -| Error Object | Status Code | Content Type | -| -------------------------------------- | -------------------------------------- | -------------------------------------- | -| sdkerrors.GetSearchResultsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| sdkerrors.GetSearchResultsResponseBody | 400 | application/json | +| sdkerrors.GetSearchResultsSearchResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/server/README.md b/docs/sdks/server/README.md index 729cda3..4a11539 100644 --- a/docs/sdks/server/README.md +++ b/docs/sdks/server/README.md @@ -15,6 +15,7 @@ Operations against the Plex Media Server System. * [GetServerIdentity](#getserveridentity) - Get Server Identity * [GetMyPlexAccount](#getmyplexaccount) - Get MyPlex Account * [GetResizedPhoto](#getresizedphoto) - Get a Resized Photo +* [GetMediaProviders](#getmediaproviders) - Get Media Providers * [GetServerList](#getserverlist) - Get Server List ## GetServerCapabilities @@ -35,7 +36,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -51,18 +52,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetServerCapabilitiesResponse](../../models/operations/getservercapabilitiesresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | -| sdkerrors.GetServerCapabilitiesResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | +| sdkerrors.GetServerCapabilitiesResponseBody | 400 | application/json | +| sdkerrors.GetServerCapabilitiesServerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetServerPreferences @@ -82,7 +88,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -98,18 +104,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetServerPreferencesResponse](../../models/operations/getserverpreferencesresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| sdkerrors.GetServerPreferencesResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------------ | ------------------------------------------------ | ------------------------------------------------ | +| sdkerrors.GetServerPreferencesResponseBody | 400 | application/json | +| sdkerrors.GetServerPreferencesServerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetAvailableClients @@ -129,7 +140,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -145,18 +156,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetAvailableClientsResponse](../../models/operations/getavailableclientsresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | -| sdkerrors.GetAvailableClientsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | +| sdkerrors.GetAvailableClientsResponseBody | 400 | application/json | +| sdkerrors.GetAvailableClientsServerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetDevices @@ -176,7 +192,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -192,22 +208,27 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetDevicesResponse](../../models/operations/getdevicesresponse.md), error** -| Error Object | Status Code | Content Type | -| -------------------------------- | -------------------------------- | -------------------------------- | -| sdkerrors.GetDevicesResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| sdkerrors.GetDevicesResponseBody | 400 | application/json | +| sdkerrors.GetDevicesServerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetServerIdentity -Get Server Identity +This request is useful to determine if the server is online or offline ### Example Usage @@ -222,8 +243,7 @@ import( func main() { s := plexgo.New( - plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -239,19 +259,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetServerIdentityResponse](../../models/operations/getserveridentityresponse.md), error** + +### Errors + | Error Object | Status Code | Content Type | | --------------------------------------- | --------------------------------------- | --------------------------------------- | -| sdkerrors.GetServerIdentityResponseBody | 401 | application/json | +| sdkerrors.GetServerIdentityResponseBody | 408 | application/json | | sdkerrors.SDKError | 4xx-5xx | */* | + ## GetMyPlexAccount Returns MyPlex Account Information @@ -270,7 +294,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -286,18 +310,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetMyPlexAccountResponse](../../models/operations/getmyplexaccountresponse.md), error** -| Error Object | Status Code | Content Type | -| -------------------------------------- | -------------------------------------- | -------------------------------------- | -| sdkerrors.GetMyPlexAccountResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| sdkerrors.GetMyPlexAccountResponseBody | 400 | application/json | +| sdkerrors.GetMyPlexAccountServerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetResizedPhoto @@ -311,27 +340,27 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - request := operations.GetResizedPhotoRequest{ + + ctx := context.Background() + res, err := s.Server.GetResizedPhoto(ctx, operations.GetResizedPhotoRequest{ Width: 110, Height: 165, Opacity: 100, Blur: 20, MinSize: operations.MinSizeOne, - Upscale: operations.UpscaleZero, + Upscale: operations.UpscaleOne, URL: "/library/metadata/49564/thumb/1654258204", - } - ctx := context.Background() - res, err := s.Server.GetResizedPhoto(ctx, request) + }) if err != nil { log.Fatal(err) } @@ -347,15 +376,73 @@ func main() { | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `request` | [operations.GetResizedPhotoRequest](../../models/operations/getresizedphotorequest.md) | :heavy_check_mark: | The request object to use for the request. | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetResizedPhotoResponse](../../models/operations/getresizedphotoresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------- | ------------------------------------- | ------------------------------------- | -| sdkerrors.GetResizedPhotoResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| sdkerrors.GetResizedPhotoResponseBody | 400 | application/json | +| sdkerrors.GetResizedPhotoServerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + + +## GetMediaProviders + +Retrieves media providers and their features from the Plex server. + +### Example Usage + +```go +package main + +import( + "github.com/LukeHagar/plexgo" + "context" + "log" +) + +func main() { + s := plexgo.New( + plexgo.WithSecurity(""), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), + ) + + ctx := context.Background() + res, err := s.Server.GetMediaProviders(ctx, "CV5xoxjTpFKUzBTShsaf") + if err != nil { + log.Fatal(err) + } + if res.Object != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `xPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | + +### Response + +**[*operations.GetMediaProvidersResponse](../../models/operations/getmediaprovidersresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| sdkerrors.GetMediaProvidersResponseBody | 400 | application/json | +| sdkerrors.GetMediaProvidersServerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetServerList @@ -375,7 +462,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -391,15 +478,19 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetServerListResponse](../../models/operations/getserverlistresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | -| sdkerrors.GetServerListResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| sdkerrors.GetServerListResponseBody | 400 | application/json | +| sdkerrors.GetServerListServerResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/sessions/README.md b/docs/sdks/sessions/README.md index d8aa611..f5372ad 100644 --- a/docs/sdks/sessions/README.md +++ b/docs/sdks/sessions/README.md @@ -31,7 +31,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -47,18 +47,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetSessionsResponse](../../models/operations/getsessionsresponse.md), error** -| Error Object | Status Code | Content Type | -| --------------------------------- | --------------------------------- | --------------------------------- | -| sdkerrors.GetSessionsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| sdkerrors.GetSessionsResponseBody | 400 | application/json | +| sdkerrors.GetSessionsSessionsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetSessionHistory @@ -71,25 +76,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sort *string = plexgo.String("") - var accountID *int64 = plexgo.Int64(1) - - var filter *operations.Filter = &operations.Filter{} - - var librarySectionID *int64 = plexgo.Int64(12) ctx := context.Background() - res, err := s.Sessions.GetSessionHistory(ctx, sort, accountID, filter, librarySectionID) + res, err := s.Sessions.GetSessionHistory(ctx, plexgo.String("viewedAt:desc"), plexgo.Int64(1), &operations.QueryParamFilter{}, plexgo.Int64(12)) if err != nil { log.Fatal(err) } @@ -106,17 +105,22 @@ func main() { | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | | `sort` | **string* | :heavy_minus_sign: | Sorts the results by the specified field followed by the direction (asc, desc)
| | | `accountID` | **int64* | :heavy_minus_sign: | Filter results by those that are related to a specific users id
| 1 | -| `filter` | [*operations.Filter](../../models/operations/filter.md) | :heavy_minus_sign: | Filters content by field and direction/equality
(Unknown if viewedAt is the only supported column)
| {
"viewed-at-greater-than": {
"value": "viewedAt\u003e"
},
"viewed-at-greater-than-or-equal-to": {
"value": "viewedAt\u003e=\u003e"
},
"viewed-at-less-than": {
"value": "viewedAt\u003c"
}
} | +| `filter` | [*operations.QueryParamFilter](../../models/operations/queryparamfilter.md) | :heavy_minus_sign: | Filters content by field and direction/equality
(Unknown if viewedAt is the only supported column)
| {
"viewed-at-greater-than": {
"value": "viewedAt\u003e"
},
"viewed-at-greater-than-or-equal-to": {
"value": "viewedAt\u003e=\u003e"
},
"viewed-at-less-than": {
"value": "viewedAt\u003c"
}
} | | `librarySectionID` | **int64* | :heavy_minus_sign: | Filters the results based on the id of a valid library section
| 12 | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.GetSessionHistoryResponse](../../models/operations/getsessionhistoryresponse.md), error** -| Error Object | Status Code | Content Type | -| --------------------------------------- | --------------------------------------- | --------------------------------------- | -| sdkerrors.GetSessionHistoryResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | +| sdkerrors.GetSessionHistoryResponseBody | 400 | application/json | +| sdkerrors.GetSessionHistorySessionsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetTranscodeSessions @@ -136,7 +140,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -152,18 +156,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetTranscodeSessionsResponse](../../models/operations/gettranscodesessionsresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| sdkerrors.GetTranscodeSessionsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| sdkerrors.GetTranscodeSessionsResponseBody | 400 | application/json | +| sdkerrors.GetTranscodeSessionsSessionsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## StopTranscodeSession @@ -183,11 +192,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var sessionKey string = "zz7llzqlx8w9vnrsbnwhbmep" + ctx := context.Background() - res, err := s.Sessions.StopTranscodeSession(ctx, sessionKey) + res, err := s.Sessions.StopTranscodeSession(ctx, "zz7llzqlx8w9vnrsbnwhbmep") if err != nil { log.Fatal(err) } @@ -199,16 +208,20 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | Example | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | -| `sessionKey` | *string* | :heavy_check_mark: | the Key of the transcode session to stop | zz7llzqlx8w9vnrsbnwhbmep | - +| Parameter | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | +| `sessionKey` | *string* | :heavy_check_mark: | the Key of the transcode session to stop | zz7llzqlx8w9vnrsbnwhbmep | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.StopTranscodeSessionResponse](../../models/operations/stoptranscodesessionresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ | -| sdkerrors.StopTranscodeSessionResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| sdkerrors.StopTranscodeSessionResponseBody | 400 | application/json | +| sdkerrors.StopTranscodeSessionSessionsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/statistics/README.md b/docs/sdks/statistics/README.md index 8f29f7b..2d26549 100644 --- a/docs/sdks/statistics/README.md +++ b/docs/sdks/statistics/README.md @@ -30,11 +30,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var timespan *int64 = plexgo.Int64(4) + ctx := context.Background() - res, err := s.Statistics.GetStatistics(ctx, timespan) + res, err := s.Statistics.GetStatistics(ctx, plexgo.Int64(4)) if err != nil { log.Fatal(err) } @@ -50,15 +50,20 @@ func main() { | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | | `timespan` | **int64* | :heavy_minus_sign: | The timespan to retrieve statistics for
the exact meaning of this parameter is not known
| 4 | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.GetStatisticsResponse](../../models/operations/getstatisticsresponse.md), error** -| Error Object | Status Code | Content Type | -| ----------------------------------- | ----------------------------------- | ----------------------------------- | -| sdkerrors.GetStatisticsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | +| sdkerrors.GetStatisticsResponseBody | 400 | application/json | +| sdkerrors.GetStatisticsStatisticsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetResourcesStatistics @@ -78,11 +83,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var timespan *int64 = plexgo.Int64(4) + ctx := context.Background() - res, err := s.Statistics.GetResourcesStatistics(ctx, timespan) + res, err := s.Statistics.GetResourcesStatistics(ctx, plexgo.Int64(4)) if err != nil { log.Fatal(err) } @@ -98,15 +103,20 @@ func main() { | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | | `timespan` | **int64* | :heavy_minus_sign: | The timespan to retrieve statistics for
the exact meaning of this parameter is not known
| 4 | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.GetResourcesStatisticsResponse](../../models/operations/getresourcesstatisticsresponse.md), error** -| Error Object | Status Code | Content Type | -| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -| sdkerrors.GetResourcesStatisticsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| sdkerrors.GetResourcesStatisticsResponseBody | 400 | application/json | +| sdkerrors.GetResourcesStatisticsStatisticsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetBandwidthStatistics @@ -126,11 +136,11 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var timespan *int64 = plexgo.Int64(4) + ctx := context.Background() - res, err := s.Statistics.GetBandwidthStatistics(ctx, timespan) + res, err := s.Statistics.GetBandwidthStatistics(ctx, plexgo.Int64(4)) if err != nil { log.Fatal(err) } @@ -146,12 +156,16 @@ func main() { | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | | `timespan` | **int64* | :heavy_minus_sign: | The timespan to retrieve statistics for
the exact meaning of this parameter is not known
| 4 | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.GetBandwidthStatisticsResponse](../../models/operations/getbandwidthstatisticsresponse.md), error** -| Error Object | Status Code | Content Type | -| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | -| sdkerrors.GetBandwidthStatisticsResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| sdkerrors.GetBandwidthStatisticsResponseBody | 400 | application/json | +| sdkerrors.GetBandwidthStatisticsStatisticsResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/updater/README.md b/docs/sdks/updater/README.md index 87e22e2..ee7fd4d 100644 --- a/docs/sdks/updater/README.md +++ b/docs/sdks/updater/README.md @@ -31,7 +31,7 @@ import( func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) ctx := context.Background() @@ -47,18 +47,23 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | - +| Parameter | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetUpdateStatusResponse](../../models/operations/getupdatestatusresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------- | ------------------------------------- | ------------------------------------- | -| sdkerrors.GetUpdateStatusResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| sdkerrors.GetUpdateStatusResponseBody | 400 | application/json | +| sdkerrors.GetUpdateStatusUpdaterResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## CheckForUpdates @@ -71,19 +76,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var download *operations.Download = operations.DownloadOne.ToPointer() + ctx := context.Background() - res, err := s.Updater.CheckForUpdates(ctx, download) + res, err := s.Updater.CheckForUpdates(ctx, operations.DownloadOne.ToPointer()) if err != nil { log.Fatal(err) } @@ -99,15 +104,20 @@ func main() { | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | | `download` | [*operations.Download](../../models/operations/download.md) | :heavy_minus_sign: | Indicate that you want to start download any updates found. | 1 | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.CheckForUpdatesResponse](../../models/operations/checkforupdatesresponse.md), error** -| Error Object | Status Code | Content Type | -| ------------------------------------- | ------------------------------------- | ------------------------------------- | -| sdkerrors.CheckForUpdatesResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------- | -------------------------------------------- | -------------------------------------------- | +| sdkerrors.CheckForUpdatesResponseBody | 400 | application/json | +| sdkerrors.CheckForUpdatesUpdaterResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## ApplyUpdates @@ -121,21 +131,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - var tonight *operations.Tonight = operations.TonightOne.ToPointer() - var skip *operations.Skip = operations.SkipOne.ToPointer() ctx := context.Background() - res, err := s.Updater.ApplyUpdates(ctx, tonight, skip) + res, err := s.Updater.ApplyUpdates(ctx, operations.TonightOne.ToPointer(), operations.SkipOne.ToPointer()) if err != nil { log.Fatal(err) } @@ -151,13 +159,17 @@ func main() { | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | | `tonight` | [*operations.Tonight](../../models/operations/tonight.md) | :heavy_minus_sign: | Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install | 1 | -| `skip` | [*operations.Skip](../../models/operations/skip.md) | :heavy_minus_sign: | Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. | 1 | - +| `skip` | [*operations.Skip](../../models/operations/skip.md) | :heavy_minus_sign: | Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`. | 1 | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | | ### Response **[*operations.ApplyUpdatesResponse](../../models/operations/applyupdatesresponse.md), error** -| Error Object | Status Code | Content Type | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | -| sdkerrors.ApplyUpdatesResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| sdkerrors.ApplyUpdatesResponseBody | 400 | application/json | +| sdkerrors.ApplyUpdatesUpdaterResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/video/README.md b/docs/sdks/video/README.md index 0821981..a148366 100644 --- a/docs/sdks/video/README.md +++ b/docs/sdks/video/README.md @@ -22,17 +22,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - request := operations.GetTimelineRequest{ + + ctx := context.Background() + res, err := s.Video.GetTimeline(ctx, operations.GetTimelineRequest{ RatingKey: 23409, Key: "/library/metadata/23409", State: operations.StatePlaying, @@ -43,9 +45,7 @@ func main() { PlayQueueItemID: 1, PlayBackTime: 2000, Row: 1, - } - ctx := context.Background() - res, err := s.Video.GetTimeline(ctx, request) + }) if err != nil { log.Fatal(err) } @@ -61,15 +61,20 @@ func main() { | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `request` | [operations.GetTimelineRequest](../../models/operations/gettimelinerequest.md) | :heavy_check_mark: | The request object to use for the request. | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.GetTimelineResponse](../../models/operations/gettimelineresponse.md), error** -| Error Object | Status Code | Content Type | -| --------------------------------- | --------------------------------- | --------------------------------- | -| sdkerrors.GetTimelineResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------- | -------------------------------------- | -------------------------------------- | +| sdkerrors.GetTimelineResponseBody | 400 | application/json | +| sdkerrors.GetTimelineVideoResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## StartUniversalTranscode @@ -82,17 +87,19 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - request := operations.StartUniversalTranscodeRequest{ + + ctx := context.Background() + res, err := s.Video.StartUniversalTranscode(ctx, operations.StartUniversalTranscodeRequest{ HasMDE: 1, Path: "/library/metadata/23409", MediaIndex: 0, @@ -109,9 +116,7 @@ func main() { Session: plexgo.String("zvcage8b7rkioqcm8f4uns4c"), AddDebugOverlay: plexgo.Float64(0), AutoAdjustQuality: plexgo.Float64(0), - } - ctx := context.Background() - res, err := s.Video.StartUniversalTranscode(ctx, request) + }) if err != nil { log.Fatal(err) } @@ -127,12 +132,16 @@ func main() { | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | `request` | [operations.StartUniversalTranscodeRequest](../../models/operations/startuniversaltranscoderequest.md) | :heavy_check_mark: | The request object to use for the request. | - +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | ### Response **[*operations.StartUniversalTranscodeResponse](../../models/operations/startuniversaltranscoderesponse.md), error** -| Error Object | Status Code | Content Type | -| --------------------------------------------- | --------------------------------------------- | --------------------------------------------- | -| sdkerrors.StartUniversalTranscodeResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | + +### Errors + +| Error Object | Status Code | Content Type | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| sdkerrors.StartUniversalTranscodeResponseBody | 400 | application/json | +| sdkerrors.StartUniversalTranscodeVideoResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/docs/sdks/watchlist/README.md b/docs/sdks/watchlist/README.md index 583ff15..2dafde5 100644 --- a/docs/sdks/watchlist/README.md +++ b/docs/sdks/watchlist/README.md @@ -8,9 +8,9 @@ API Calls that perform operations with Plex Media Server Watchlists ### Available Operations -* [GetWatchlist](#getwatchlist) - Get User Watchlist +* [GetWatchList](#getwatchlist) - Get User Watchlist -## GetWatchlist +## GetWatchList Get User Watchlist @@ -21,22 +21,24 @@ package main import( "github.com/LukeHagar/plexgo" - "github.com/LukeHagar/plexgo/models/operations" "context" + "github.com/LukeHagar/plexgo/models/operations" "log" ) func main() { s := plexgo.New( plexgo.WithSecurity(""), - plexgo.WithXPlexClientIdentifier("Postman"), + plexgo.WithXPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40"), ) - request := operations.GetWatchlistRequest{ - Filter: operations.PathParamFilterReleased, - XPlexToken: "", - } + ctx := context.Background() - res, err := s.Watchlist.GetWatchlist(ctx, request) + 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) } @@ -51,14 +53,17 @@ func main() { | Parameter | Type | Required | Description | | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `request` | [operations.GetWatchlistRequest](../../models/operations/getwatchlistrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `request` | [operations.GetWatchListRequest](../../models/operations/getwatchlistrequest.md) | :heavy_check_mark: | The request object to use for the request. | | `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | - ### Response -**[*operations.GetWatchlistResponse](../../models/operations/getwatchlistresponse.md), error** -| Error Object | Status Code | Content Type | -| ---------------------------------- | ---------------------------------- | ---------------------------------- | -| sdkerrors.GetWatchlistResponseBody | 401 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +**[*operations.GetWatchListResponse](../../models/operations/getwatchlistresponse.md), error** + +### Errors + +| Error Object | Status Code | Content Type | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| sdkerrors.GetWatchListResponseBody | 400 | application/json | +| sdkerrors.GetWatchListWatchlistResponseBody | 401 | application/json | +| sdkerrors.SDKError | 4xx-5xx | */* | diff --git a/hubs.go b/hubs.go index 9ead6b9..c4def77 100644 --- a/hubs.go +++ b/hubs.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -28,7 +29,7 @@ func newHubs(sdkConfig sdkConfiguration) *Hubs { // GetGlobalHubs - Get Global Hubs // Get Global Hubs filtered by the parameters provided. -func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient *operations.OnlyTransient) (*operations.GetGlobalHubsResponse, error) { +func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient *operations.OnlyTransient, opts ...operations.Option) (*operations.GetGlobalHubsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getGlobalHubs", @@ -41,12 +42,35 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient OnlyTransient: onlyTransient, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/hubs") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -62,33 +86,89 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetGlobalHubsResponse{ @@ -97,17 +177,25 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetGlobalHubsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -115,17 +203,21 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetGlobalHubsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -134,9 +226,51 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetGlobalHubsHubsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -146,7 +280,7 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient // GetLibraryHubs - Get library specific hubs // This endpoint will return a list of library specific hubs -func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *float64, onlyTransient *operations.QueryParamOnlyTransient) (*operations.GetLibraryHubsResponse, error) { +func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *float64, onlyTransient *operations.QueryParamOnlyTransient, opts ...operations.Option) (*operations.GetLibraryHubsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getLibraryHubs", @@ -160,12 +294,35 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *flo OnlyTransient: onlyTransient, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/hubs/sections/{sectionId}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -181,33 +338,89 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *flo return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetLibraryHubsResponse{ @@ -216,17 +429,25 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *flo RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetLibraryHubsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -234,17 +455,21 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *flo res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetLibraryHubsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -253,9 +478,51 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *flo out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetLibraryHubsHubsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/internal/globals/globals.go b/internal/globals/globals.go index c93e2de..7722dd1 100644 --- a/internal/globals/globals.go +++ b/internal/globals/globals.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package globals @@ -7,7 +7,7 @@ type Globals struct { // This is used to track the client application and its usage // (UUID, serial number, or other number unique per device) // - XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` + XPlexClientIdentifier *string `queryParam:"style=form,explode=true,name=X-Plex-Client-Identifier"` } func (o *Globals) GetXPlexClientIdentifier() *string { diff --git a/internal/hooks/hooks.go b/internal/hooks/hooks.go index ee97182..8ea491a 100644 --- a/internal/hooks/hooks.go +++ b/internal/hooks/hooks.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package hooks diff --git a/internal/utils/contenttype.go b/internal/utils/contenttype.go index 763f2d6..f6487e0 100644 --- a/internal/utils/contenttype.go +++ b/internal/utils/contenttype.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/internal/utils/form.go b/internal/utils/form.go index 89832ea..8a1bbbb 100644 --- a/internal/utils/form.go +++ b/internal/utils/form.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/internal/utils/headers.go b/internal/utils/headers.go index 107d210..a07608b 100644 --- a/internal/utils/headers.go +++ b/internal/utils/headers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/internal/utils/json.go b/internal/utils/json.go index afb6e90..913aeaf 100644 --- a/internal/utils/json.go +++ b/internal/utils/json.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -165,11 +165,17 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool if field.Tag.Get("const") != "" { if r, ok := unmarhsaled[fieldName]; ok { val := string(r) + if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) { - val = val[1 : len(val)-1] + var err error + val, err = strconv.Unquote(val) + if err != nil { + return fmt.Errorf("failed to unquote const field `%s` value `%s`: %w", fieldName, val, err) + } } - if val != field.Tag.Get("const") { - return fmt.Errorf("const field %s does not match expected value %s", fieldName, field.Tag.Get("const")) + constValue := field.Tag.Get("const") + if val != constValue { + return fmt.Errorf("const field `%s` does not match expected value `%s` got `%s`", fieldName, constValue, val) } delete(unmarhsaled, fieldName) @@ -481,30 +487,29 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa v.Set(m) return nil case reflect.Slice, reflect.Array: - if bytes.Equal(value, []byte("null")) || !isComplexValueType(dereferenceTypePointer(typ.Elem())) { - if v.CanAddr() { - return json.Unmarshal(value, v.Addr().Interface()) - } else { - return json.Unmarshal(value, v.Interface()) - } - } + var unmarshaled []json.RawMessage - var unmarhsaled []json.RawMessage - - if err := json.Unmarshal(value, &unmarhsaled); err != nil { + if err := json.Unmarshal(value, &unmarshaled); err != nil { return err } - arrVal := v + arrVal := reflect.MakeSlice(typ, len(unmarshaled), len(unmarshaled)) - for _, value := range unmarhsaled { + for index, value := range unmarshaled { itemVal := reflect.New(typ.Elem()) if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil { return err } - arrVal = reflect.Append(arrVal, itemVal.Elem()) + arrVal.Index(index).Set(itemVal.Elem()) + } + + if v.Kind() == reflect.Pointer { + if v.IsNil() { + v.Set(reflect.New(typ)) + } + v = v.Elem() } v.Set(arrVal) diff --git a/internal/utils/pathparams.go b/internal/utils/pathparams.go index 1eccb02..ac1bd2a 100644 --- a/internal/utils/pathparams.go +++ b/internal/utils/pathparams.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/internal/utils/queryparams.go b/internal/utils/queryparams.go index e2c5b9d..6623e7a 100644 --- a/internal/utils/queryparams.go +++ b/internal/utils/queryparams.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -6,12 +6,23 @@ import ( "context" "encoding/json" "fmt" + "math/big" "net/http" "net/url" "reflect" + "time" + + "github.com/ericlagergren/decimal" + + "github.com/LukeHagar/plexgo/types" ) func PopulateQueryParams(_ context.Context, req *http.Request, queryParams interface{}, globals interface{}) error { + // Query parameters may already be present from overriding URL + if req.URL.RawQuery != "" { + return nil + } + values := url.Values{} globalsAlreadyPopulated, err := populateQueryParams(queryParams, globals, values, []string{}) @@ -132,56 +143,99 @@ func populateDeepObjectParams(tag *paramTag, objType reflect.Type, objValue refl return values } - if objType.Kind() == reflect.Pointer { - objType = objType.Elem() + if objValue.Kind() == reflect.Pointer { objValue = objValue.Elem() } - switch objType.Kind() { - case reflect.Struct: - for i := 0; i < objType.NumField(); i++ { - fieldType := objType.Field(i) - valType := objValue.Field(i) - - if isNil(fieldType.Type, valType) { - continue - } - - if fieldType.Type.Kind() == reflect.Pointer { - valType = valType.Elem() - } - - qpTag := parseQueryParamTag(fieldType) - if qpTag == nil { - continue - } - - switch valType.Kind() { - case reflect.Array, reflect.Slice: - for i := 0; i < valType.Len(); i++ { - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, qpTag.ParamName), valToString(valType.Index(i).Interface())) - } - default: - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, qpTag.ParamName), valToString(valType.Interface())) - } - } + switch objValue.Kind() { case reflect.Map: - iter := objValue.MapRange() - for iter.Next() { - switch iter.Value().Kind() { - case reflect.Array, reflect.Slice: - for i := 0; i < iter.Value().Len(); i++ { - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, iter.Key().String()), valToString(iter.Value().Index(i).Interface())) - } - default: - values.Add(fmt.Sprintf("%s[%s]", tag.ParamName, iter.Key().String()), valToString(iter.Value().Interface())) - } - } + populateDeepObjectParamsMap(values, tag.ParamName, objValue) + case reflect.Struct: + populateDeepObjectParamsStruct(values, tag.ParamName, objValue) } return values } +func populateDeepObjectParamsArray(qsValues url.Values, priorScope string, value reflect.Value) { + if value.Kind() != reflect.Array && value.Kind() != reflect.Slice { + return + } + + for i := 0; i < value.Len(); i++ { + qsValues.Add(priorScope, valToString(value.Index(i).Interface())) + } +} + +func populateDeepObjectParamsMap(qsValues url.Values, priorScope string, mapValue reflect.Value) { + if mapValue.Kind() != reflect.Map { + return + } + + iter := mapValue.MapRange() + + for iter.Next() { + scope := priorScope + "[" + iter.Key().String() + "]" + iterValue := iter.Value() + + switch iterValue.Kind() { + case reflect.Array, reflect.Slice: + populateDeepObjectParamsArray(qsValues, scope, iterValue) + case reflect.Map: + populateDeepObjectParamsMap(qsValues, scope, iterValue) + default: + qsValues.Add(scope, valToString(iterValue.Interface())) + } + } +} + +func populateDeepObjectParamsStruct(qsValues url.Values, priorScope string, structValue reflect.Value) { + if structValue.Kind() != reflect.Struct { + return + } + + structType := structValue.Type() + + for i := 0; i < structType.NumField(); i++ { + field := structType.Field(i) + fieldValue := structValue.Field(i) + + if isNil(field.Type, fieldValue) { + continue + } + + if fieldValue.Kind() == reflect.Pointer { + fieldValue = fieldValue.Elem() + } + + qpTag := parseQueryParamTag(field) + + if qpTag == nil { + continue + } + + scope := priorScope + "[" + qpTag.ParamName + "]" + + switch fieldValue.Kind() { + case reflect.Array, reflect.Slice: + populateDeepObjectParamsArray(qsValues, scope, fieldValue) + case reflect.Map: + populateDeepObjectParamsMap(qsValues, scope, fieldValue) + case reflect.Struct: + switch fieldValue.Type() { + case reflect.TypeOf(big.Int{}), reflect.TypeOf(decimal.Big{}), reflect.TypeOf(time.Time{}), reflect.TypeOf(types.Date{}): + qsValues.Add(scope, valToString(fieldValue.Interface())) + + continue + } + + populateDeepObjectParamsStruct(qsValues, scope, fieldValue) + default: + qsValues.Add(scope, valToString(fieldValue.Interface())) + } + } +} + func populateFormParams(tag *paramTag, objType reflect.Type, objValue reflect.Value, delimiter string) url.Values { return populateForm(tag.ParamName, tag.Explode, objType, objValue, delimiter, func(fieldType reflect.StructField) string { qpTag := parseQueryParamTag(fieldType) diff --git a/internal/utils/requestbody.go b/internal/utils/requestbody.go index cfb2ba6..000226e 100644 --- a/internal/utils/requestbody.go +++ b/internal/utils/requestbody.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -66,15 +66,16 @@ func serializeRequestBody(request interface{}, nullable, optional bool, requestF if tag != nil { // request object (non-flattened) requestVal := requestValType.FieldByName(requestFieldName) + val := reflect.ValueOf(requestVal.Interface()) if isNil(requestField.Type, requestVal) { if !nullable && optional { return nil, "", nil } - return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) + return serializeContentType(requestFieldName, tag.MediaType, val, string(requestField.Tag)) } - return serializeContentType(requestFieldName, tag.MediaType, requestVal, string(requestField.Tag)) + return serializeContentType(requestFieldName, tag.MediaType, val, string(requestField.Tag)) } } @@ -82,7 +83,7 @@ func serializeRequestBody(request interface{}, nullable, optional bool, requestF return serializeContentType(requestFieldName, SerializationMethodToContentType[serializationMethod], reflect.ValueOf(request), tag) } -func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (*bytes.Buffer, string, error) { +func serializeContentType(fieldName string, mediaType string, val reflect.Value, tag string) (io.Reader, string, error) { buf := &bytes.Buffer{} if isNil(val.Type(), val) { @@ -116,6 +117,8 @@ func serializeContentType(fieldName string, mediaType string, val reflect.Value, if err := encodeFormData(fieldName, buf, val.Interface()); err != nil { return nil, "", err } + case val.Type().Implements(reflect.TypeOf((*io.Reader)(nil)).Elem()): + return val.Interface().(io.Reader), mediaType, nil default: val = reflect.Indirect(val) @@ -124,8 +127,8 @@ func serializeContentType(fieldName string, mediaType string, val reflect.Value, if _, err := buf.WriteString(valToString(val.Interface())); err != nil { return nil, "", err } - case val.Type() == reflect.TypeOf([]byte(nil)): - if _, err := buf.Write(val.Bytes()); err != nil { + case reflect.TypeOf(val.Interface()) == reflect.TypeOf([]byte(nil)): + if _, err := buf.Write(val.Interface().([]byte)); err != nil { return nil, "", err } default: @@ -215,7 +218,7 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va var fieldName string var fileName string - var content []byte + var reader io.Reader for i := 0; i < fieldType.NumField(); i++ { field := fieldType.Field(i) @@ -226,15 +229,19 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va continue } - if tag.Content { - content = val.Bytes() + if tag.Content && val.CanInterface() { + if reflect.TypeOf(val.Interface()) == reflect.TypeOf([]byte(nil)) { + reader = bytes.NewReader(val.Interface().([]byte)) + } else if reflect.TypeOf(val.Interface()).Implements(reflect.TypeOf((*io.Reader)(nil)).Elem()) { + reader = val.Interface().(io.Reader) + } } else { fieldName = tag.Name fileName = val.String() } } - if fieldName == "" || fileName == "" || content == nil { + if fieldName == "" || fileName == "" || reader == nil { return fmt.Errorf("invalid multipart/form-data file") } @@ -242,7 +249,7 @@ func encodeMultipartFormDataFile(w *multipart.Writer, fieldType reflect.Type, va if err != nil { return err } - if _, err := fw.Write(content); err != nil { + if _, err := io.Copy(fw, reader); err != nil { return err } diff --git a/internal/utils/retries.go b/internal/utils/retries.go index ff39d0d..d429b45 100644 --- a/internal/utils/retries.go +++ b/internal/utils/retries.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -6,32 +6,25 @@ import ( "context" "errors" "fmt" + "github.com/LukeHagar/plexgo/retry" + "github.com/cenkalti/backoff/v4" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/cenkalti/backoff/v4" ) var errRequestFailed = errors.New("request failed") -type BackoffStrategy struct { - InitialInterval int - MaxInterval int - Exponent float64 - MaxElapsedTime int -} +// Deprecated: Use retry.BackoffStrategy instead. +type BackoffStrategy = retry.BackoffStrategy -type RetryConfig struct { - Strategy string - Backoff *BackoffStrategy - RetryConnectionErrors bool -} +// Deprecated: Use retry.Config instead. +type RetryConfig = retry.Config type Retries struct { - Config *RetryConfig + Config *retry.Config StatusCodes []string } diff --git a/internal/utils/security.go b/internal/utils/security.go index f7abb69..19dfa6f 100644 --- a/internal/utils/security.go +++ b/internal/utils/security.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils @@ -21,6 +21,7 @@ type securityTag struct { Name string Type string SubType string + Env string } func PopulateSecurity(ctx context.Context, req *http.Request, securitySource func(context.Context) (interface{}, error)) error { @@ -118,9 +119,14 @@ func parseSecurityScheme(headers, queryParams map[string]string, schemeTag *secu } if schemeType.Kind() == reflect.Struct { - if schemeTag.Type == "http" && schemeTag.SubType == "basic" { - handleBasicAuthScheme(headers, schemeVal.Interface()) - return + if schemeTag.Type == "http" { + switch schemeTag.SubType { + case "basic": + handleBasicAuthScheme(headers, schemeVal.Interface()) + return + case "custom": + return + } } for i := 0; i < schemeType.NumField(); i++ { @@ -170,6 +176,7 @@ func parseSecuritySchemeValue(headers, queryParams map[string]string, schemeTag switch schemeTag.SubType { case "bearer": headers[secTag.Name] = prefixBearer(valToString(val)) + case "custom": default: panic("not supported") } @@ -227,6 +234,7 @@ func parseSecurityTag(field reflect.StructField) *securityTag { name := "" securityType := "" securitySubType := "" + env := "" options := strings.Split(tag, ",") for _, optionConf := range options { @@ -246,6 +254,8 @@ func parseSecurityTag(field reflect.StructField) *securityTag { option = true case "scheme": scheme = true + case "env": + env = parts[1] } } @@ -257,6 +267,7 @@ func parseSecurityTag(field reflect.StructField) *securityTag { Name: name, Type: securityType, SubType: securitySubType, + Env: env, } } diff --git a/internal/utils/utils.go b/internal/utils/utils.go index eab3682..adb2f70 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package utils diff --git a/library.go b/library.go index c446efd..8f79f81 100644 --- a/library.go +++ b/library.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -28,7 +29,7 @@ func newLibrary(sdkConfig sdkConfiguration) *Library { // GetFileHash - Get Hash Value // This resource returns hash values for local files -func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64) (*operations.GetFileHashResponse, error) { +func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64, opts ...operations.Option) (*operations.GetFileHashResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getFileHash", @@ -41,12 +42,35 @@ func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64) Type: type_, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/library/hashes") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -62,33 +86,89 @@ func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64) return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetFileHashResponse{ @@ -97,24 +177,26 @@ func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64) RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetFileHashResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -123,9 +205,51 @@ func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64) out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetFileHashLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -135,7 +259,7 @@ func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64) // GetRecentlyAdded - Get Recently Added // This endpoint will return the recently added content. -func (s *Library) GetRecentlyAdded(ctx context.Context) (*operations.GetRecentlyAddedResponse, error) { +func (s *Library) GetRecentlyAdded(ctx context.Context, xPlexContainerStart *int, xPlexContainerSize *int, opts ...operations.Option) (*operations.GetRecentlyAddedResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getRecentlyAdded", @@ -143,12 +267,40 @@ func (s *Library) GetRecentlyAdded(ctx context.Context) (*operations.GetRecently SecuritySource: s.sdkConfiguration.Security, } + request := operations.GetRecentlyAddedRequest{ + XPlexContainerStart: xPlexContainerStart, + XPlexContainerSize: xPlexContainerSize, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/library/recentlyAdded") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -156,37 +308,97 @@ func (s *Library) GetRecentlyAdded(ctx context.Context) (*operations.GetRecently req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetRecentlyAddedResponse{ @@ -195,17 +407,25 @@ func (s *Library) GetRecentlyAdded(ctx context.Context) (*operations.GetRecently RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetRecentlyAddedResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -213,17 +433,21 @@ func (s *Library) GetRecentlyAdded(ctx context.Context) (*operations.GetRecently res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetRecentlyAddedResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -232,9 +456,51 @@ func (s *Library) GetRecentlyAdded(ctx context.Context) (*operations.GetRecently out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetRecentlyAddedLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -242,27 +508,50 @@ func (s *Library) GetRecentlyAdded(ctx context.Context) (*operations.GetRecently } -// GetLibraries - Get All Libraries +// GetAllLibraries - Get All Libraries // A library section (commonly referred to as just a library) is a collection of media. // Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media. // For example, a music library has an artist > albums > tracks structure, whereas a movie library is flat. // // Libraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts. // This allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year). -func (s *Library) GetLibraries(ctx context.Context) (*operations.GetLibrariesResponse, error) { +func (s *Library) GetAllLibraries(ctx context.Context, opts ...operations.Option) (*operations.GetAllLibrariesResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "getLibraries", + OperationID: "get-all-libraries", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/library/sections") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -274,71 +563,139 @@ func (s *Library) GetLibraries(ctx context.Context) (*operations.GetLibrariesRes return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } - res := &operations.GetLibrariesResponse{ + res := &operations.GetAllLibrariesResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out operations.GetLibrariesResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetAllLibrariesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out sdkerrors.GetLibrariesResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetAllLibrariesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -346,9 +703,51 @@ func (s *Library) GetLibraries(ctx context.Context) (*operations.GetLibrariesRes out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetAllLibrariesLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -356,7 +755,7 @@ func (s *Library) GetLibraries(ctx context.Context) (*operations.GetLibrariesRes } -// GetLibrary - Get Library Details +// GetLibraryDetails - Get Library Details // ## Library Details Endpoint // // This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself. @@ -396,25 +795,48 @@ func (s *Library) GetLibraries(ctx context.Context) (*operations.GetLibrariesRes // - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`. // // > **Note**: Filters and sorts are optional; without them, no filtering controls are rendered. -func (s *Library) GetLibrary(ctx context.Context, sectionID float64, includeDetails *operations.IncludeDetails) (*operations.GetLibraryResponse, error) { +func (s *Library) GetLibraryDetails(ctx context.Context, sectionKey int, includeDetails *operations.IncludeDetails, opts ...operations.Option) (*operations.GetLibraryDetailsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "getLibrary", + OperationID: "get-library-details", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - request := operations.GetLibraryRequest{ - SectionID: sectionID, + request := operations.GetLibraryDetailsRequest{ + SectionKey: sectionKey, IncludeDetails: includeDetails, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -430,71 +852,139 @@ func (s *Library) GetLibrary(ctx context.Context, sectionID float64, includeDeta return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } - res := &operations.GetLibraryResponse{ + res := &operations.GetLibraryDetailsResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out operations.GetLibraryResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetLibraryDetailsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out sdkerrors.GetLibraryResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetLibraryDetailsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -502,9 +992,51 @@ func (s *Library) GetLibrary(ctx context.Context, sectionID float64, includeDeta out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetLibraryDetailsLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -513,8 +1045,8 @@ func (s *Library) GetLibrary(ctx context.Context, sectionID float64, includeDeta } // DeleteLibrary - Delete Library Section -// Delate a library using a specific section -func (s *Library) DeleteLibrary(ctx context.Context, sectionID float64) (*operations.DeleteLibraryResponse, error) { +// Delete a library using a specific section id +func (s *Library) DeleteLibrary(ctx context.Context, sectionKey int, opts ...operations.Option) (*operations.DeleteLibraryResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deleteLibrary", @@ -523,15 +1055,38 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionID float64) (*operat } request := operations.DeleteLibraryRequest{ - SectionID: sectionID, + SectionKey: sectionKey, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionId}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -543,33 +1098,89 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionID float64) (*operat return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.DeleteLibraryResponse{ @@ -578,24 +1189,26 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionID float64) (*operat RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.DeleteLibraryResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -604,9 +1217,51 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionID float64) (*operat out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.DeleteLibraryLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -635,26 +1290,43 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionID float64) (*operat // - `resolution`: Items categorized by resolution. // - `firstCharacter`: Items categorized by the first letter. // - `folder`: Items categorized by folder. -func (s *Library) GetLibraryItems(ctx context.Context, sectionID any, tag operations.Tag, includeGuids *int64) (*operations.GetLibraryItemsResponse, error) { +func (s *Library) GetLibraryItems(ctx context.Context, request operations.GetLibraryItemsRequest, opts ...operations.Option) (*operations.GetLibraryItemsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "getLibraryItems", + OperationID: "get-library-items", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - request := operations.GetLibraryItemsRequest{ - SectionID: sectionID, - Tag: tag, - IncludeGuids: includeGuids, + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionId}/{tag}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}/{tag}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -670,33 +1342,89 @@ func (s *Library) GetLibraryItems(ctx context.Context, sectionID any, tag operat return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetLibraryItemsResponse{ @@ -705,17 +1433,25 @@ func (s *Library) GetLibraryItems(ctx context.Context, sectionID any, tag operat RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetLibraryItemsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -723,17 +1459,21 @@ func (s *Library) GetLibraryItems(ctx context.Context, sectionID any, tag operat res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetLibraryItemsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -742,9 +1482,51 @@ func (s *Library) GetLibraryItems(ctx context.Context, sectionID any, tag operat out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetLibraryItemsLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -752,26 +1534,50 @@ func (s *Library) GetLibraryItems(ctx context.Context, sectionID any, tag operat } -// RefreshLibrary - Refresh Library -// This endpoint Refreshes the library. -func (s *Library) RefreshLibrary(ctx context.Context, sectionID float64) (*operations.RefreshLibraryResponse, error) { +// GetRefreshLibraryMetadata - Refresh Metadata Of The Library +// This endpoint Refreshes all the Metadata of the library. +func (s *Library) GetRefreshLibraryMetadata(ctx context.Context, sectionKey int, force *operations.Force, opts ...operations.Option) (*operations.GetRefreshLibraryMetadataResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "refreshLibrary", + OperationID: "get-refresh-library-metadata", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - request := operations.RefreshLibraryRequest{ - SectionID: sectionID, + request := operations.GetRefreshLibraryMetadataRequest{ + SectionKey: sectionKey, + Force: force, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionId}/refresh", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}/refresh", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -779,64 +1585,126 @@ func (s *Library) RefreshLibrary(ctx context.Context, sectionID float64) (*opera req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } - res := &operations.RefreshLibraryResponse{ + res := &operations.GetRefreshLibraryMetadataResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out sdkerrors.RefreshLibraryResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetRefreshLibraryMetadataResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -844,9 +1712,51 @@ func (s *Library) RefreshLibrary(ctx context.Context, sectionID float64) (*opera out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetRefreshLibraryMetadataLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -854,7 +1764,7 @@ func (s *Library) RefreshLibrary(ctx context.Context, sectionID float64) (*opera } -// SearchLibrary - Search Library +// GetSearchLibrary - Search Library // Search for content within a specific section of the library. // // ### Types @@ -873,25 +1783,48 @@ func (s *Library) RefreshLibrary(ctx context.Context, sectionID float64) (*opera // - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`. // // > **Note**: Filters and sorts are optional; without them, no filtering controls are rendered. -func (s *Library) SearchLibrary(ctx context.Context, sectionID int64, type_ operations.Type) (*operations.SearchLibraryResponse, error) { +func (s *Library) GetSearchLibrary(ctx context.Context, sectionKey int, type_ operations.QueryParamType, opts ...operations.Option) (*operations.GetSearchLibraryResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "searchLibrary", + OperationID: "get-search-library", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - request := operations.SearchLibraryRequest{ - SectionID: sectionID, - Type: type_, + request := operations.GetSearchLibraryRequest{ + SectionKey: sectionKey, + Type: type_, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionId}/search", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionKey}/search", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -907,71 +1840,139 @@ func (s *Library) SearchLibrary(ctx context.Context, sectionID int64, type_ oper return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } - res := &operations.SearchLibraryResponse{ + res := &operations.GetSearchLibraryResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out operations.SearchLibraryResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetSearchLibraryResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out sdkerrors.SearchLibraryResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetSearchLibraryResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -979,9 +1980,51 @@ func (s *Library) SearchLibrary(ctx context.Context, sectionID int64, type_ oper out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetSearchLibraryLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -989,26 +2032,49 @@ func (s *Library) SearchLibrary(ctx context.Context, sectionID int64, type_ oper } -// GetMetadata - Get Items Metadata +// GetMetaDataByRatingKey - Get Metadata by RatingKey // This endpoint will return the metadata of a library item specified with the ratingKey. -func (s *Library) GetMetadata(ctx context.Context, ratingKey float64) (*operations.GetMetadataResponse, error) { +func (s *Library) GetMetaDataByRatingKey(ctx context.Context, ratingKey int64, opts ...operations.Option) (*operations.GetMetaDataByRatingKeyResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "getMetadata", + OperationID: "get-meta-data-by-rating-key", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - request := operations.GetMetadataRequest{ + request := operations.GetMetaDataByRatingKeyRequest{ RatingKey: ratingKey, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/library/metadata/{ratingKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -1020,71 +2086,139 @@ func (s *Library) GetMetadata(ctx context.Context, ratingKey float64) (*operatio return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } - res := &operations.GetMetadataResponse{ + res := &operations.GetMetaDataByRatingKeyResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out operations.GetMetadataResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetMetaDataByRatingKeyResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out sdkerrors.GetMetadataResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetMetaDataByRatingKeyResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -1092,9 +2226,51 @@ func (s *Library) GetMetadata(ctx context.Context, ratingKey float64) (*operatio out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetMetaDataByRatingKeyLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -1104,7 +2280,7 @@ func (s *Library) GetMetadata(ctx context.Context, ratingKey float64) (*operatio // GetMetadataChildren - Get Items Children // This endpoint will return the children of of a library item specified with the ratingKey. -func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, includeElements *string) (*operations.GetMetadataChildrenResponse, error) { +func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, includeElements *string, opts ...operations.Option) (*operations.GetMetadataChildrenResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getMetadataChildren", @@ -1117,12 +2293,35 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in IncludeElements: includeElements, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/library/metadata/{ratingKey}/children", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -1138,33 +2337,89 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetMetadataChildrenResponse{ @@ -1173,17 +2428,25 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetMetadataChildrenResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -1191,17 +2454,21 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetMetadataChildrenResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -1210,9 +2477,51 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetMetadataChildrenLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -1222,7 +2531,7 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in // GetTopWatchedContent - Get Top Watched Content // This endpoint will return the top watched content from libraries of a certain type -func (s *Library) GetTopWatchedContent(ctx context.Context, type_ int64, includeGuids *int64) (*operations.GetTopWatchedContentResponse, error) { +func (s *Library) GetTopWatchedContent(ctx context.Context, type_ operations.GetTopWatchedContentQueryParamType, includeGuids *int64, opts ...operations.Option) (*operations.GetTopWatchedContentResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getTopWatchedContent", @@ -1235,12 +2544,35 @@ func (s *Library) GetTopWatchedContent(ctx context.Context, type_ int64, include IncludeGuids: includeGuids, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/library/all/top") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -1256,33 +2588,89 @@ func (s *Library) GetTopWatchedContent(ctx context.Context, type_ int64, include return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetTopWatchedContentResponse{ @@ -1291,17 +2679,25 @@ func (s *Library) GetTopWatchedContent(ctx context.Context, type_ int64, include RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetTopWatchedContentResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -1309,13 +2705,74 @@ func (s *Library) GetTopWatchedContent(ctx context.Context, type_ int64, include res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetTopWatchedContentResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetTopWatchedContentLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -1325,7 +2782,7 @@ func (s *Library) GetTopWatchedContent(ctx context.Context, type_ int64, include // GetOnDeck - Get On Deck // This endpoint will return the on deck content. -func (s *Library) GetOnDeck(ctx context.Context) (*operations.GetOnDeckResponse, error) { +func (s *Library) GetOnDeck(ctx context.Context, opts ...operations.Option) (*operations.GetOnDeckResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getOnDeck", @@ -1333,12 +2790,35 @@ func (s *Library) GetOnDeck(ctx context.Context) (*operations.GetOnDeckResponse, SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/library/onDeck") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -1350,33 +2830,89 @@ func (s *Library) GetOnDeck(ctx context.Context) (*operations.GetOnDeckResponse, return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetOnDeckResponse{ @@ -1385,17 +2921,25 @@ func (s *Library) GetOnDeck(ctx context.Context) (*operations.GetOnDeckResponse, RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetOnDeckResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -1403,17 +2947,21 @@ func (s *Library) GetOnDeck(ctx context.Context) (*operations.GetOnDeckResponse, res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetOnDeckResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -1422,9 +2970,51 @@ func (s *Library) GetOnDeck(ctx context.Context) (*operations.GetOnDeckResponse, out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetOnDeckLibraryResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/log.go b/log.go index b768854..7704d3c 100644 --- a/log.go +++ b/log.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -28,7 +29,7 @@ func newLog(sdkConfig sdkConfiguration) *Log { // LogLine - Logging a single line message. // This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log. -func (s *Log) LogLine(ctx context.Context, level operations.Level, message string, source string) (*operations.LogLineResponse, error) { +func (s *Log) LogLine(ctx context.Context, level operations.Level, message string, source string, opts ...operations.Option) (*operations.LogLineResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "logLine", @@ -42,12 +43,35 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin Source: source, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/log") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -63,33 +87,89 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.LogLineResponse{ @@ -98,24 +178,26 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.LogLineResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -124,9 +206,51 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.LogLineLogResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -156,7 +280,7 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin // `level=4&message=Sample%20log%20entry&source=applicationName` // // Ensure each parameter is properly URL-encoded to avoid interpretation issues. -func (s *Log) LogMultiLine(ctx context.Context, request string) (*operations.LogMultiLineResponse, error) { +func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operations.Option) (*operations.LogMultiLineResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "logMultiLine", @@ -164,6 +288,18 @@ func (s *Log) LogMultiLine(ctx context.Context, request string) (*operations.Log SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/log") if err != nil { @@ -175,6 +311,17 @@ func (s *Log) LogMultiLine(ctx context.Context, request string) (*operations.Log return nil, err } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -187,33 +334,89 @@ func (s *Log) LogMultiLine(ctx context.Context, request string) (*operations.Log return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.LogMultiLineResponse{ @@ -222,24 +425,26 @@ func (s *Log) LogMultiLine(ctx context.Context, request string) (*operations.Log RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.LogMultiLineResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -248,9 +453,51 @@ func (s *Log) LogMultiLine(ctx context.Context, request string) (*operations.Log out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.LogMultiLineLogResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -260,7 +507,7 @@ func (s *Log) LogMultiLine(ctx context.Context, request string) (*operations.Log // EnablePaperTrail - Enabling Papertrail // This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time. -func (s *Log) EnablePaperTrail(ctx context.Context) (*operations.EnablePaperTrailResponse, error) { +func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) (*operations.EnablePaperTrailResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "enablePaperTrail", @@ -268,12 +515,35 @@ func (s *Log) EnablePaperTrail(ctx context.Context) (*operations.EnablePaperTrai SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/log/networked") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -285,33 +555,89 @@ func (s *Log) EnablePaperTrail(ctx context.Context) (*operations.EnablePaperTrai return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "403", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "403", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.EnablePaperTrailResponse{ @@ -320,26 +646,26 @@ func (s *Log) EnablePaperTrail(ctx context.Context) (*operations.EnablePaperTrai RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode == 403: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.EnablePaperTrailResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -348,9 +674,53 @@ func (s *Log) EnablePaperTrail(ctx context.Context) (*operations.EnablePaperTrai out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.EnablePaperTrailLogResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 403: + fallthrough + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/media.go b/media.go index 0c49c35..4e444c9 100644 --- a/media.go +++ b/media.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -28,7 +29,7 @@ func newMedia(sdkConfig sdkConfiguration) *Media { // MarkPlayed - Mark Media Played // This will mark the provided media key as Played. -func (s *Media) MarkPlayed(ctx context.Context, key float64) (*operations.MarkPlayedResponse, error) { +func (s *Media) MarkPlayed(ctx context.Context, key float64, opts ...operations.Option) (*operations.MarkPlayedResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "markPlayed", @@ -40,12 +41,35 @@ func (s *Media) MarkPlayed(ctx context.Context, key float64) (*operations.MarkPl Key: key, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/:/scrobble") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -61,33 +85,89 @@ func (s *Media) MarkPlayed(ctx context.Context, key float64) (*operations.MarkPl return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.MarkPlayedResponse{ @@ -96,24 +176,26 @@ func (s *Media) MarkPlayed(ctx context.Context, key float64) (*operations.MarkPl RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.MarkPlayedResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -122,9 +204,51 @@ func (s *Media) MarkPlayed(ctx context.Context, key float64) (*operations.MarkPl out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.MarkPlayedMediaResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -134,7 +258,7 @@ func (s *Media) MarkPlayed(ctx context.Context, key float64) (*operations.MarkPl // MarkUnplayed - Mark Media Unplayed // This will mark the provided media key as Unplayed. -func (s *Media) MarkUnplayed(ctx context.Context, key float64) (*operations.MarkUnplayedResponse, error) { +func (s *Media) MarkUnplayed(ctx context.Context, key float64, opts ...operations.Option) (*operations.MarkUnplayedResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "markUnplayed", @@ -146,12 +270,35 @@ func (s *Media) MarkUnplayed(ctx context.Context, key float64) (*operations.Mark Key: key, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/:/unscrobble") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -167,33 +314,89 @@ func (s *Media) MarkUnplayed(ctx context.Context, key float64) (*operations.Mark return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.MarkUnplayedResponse{ @@ -202,24 +405,26 @@ func (s *Media) MarkUnplayed(ctx context.Context, key float64) (*operations.Mark RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.MarkUnplayedResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -228,9 +433,51 @@ func (s *Media) MarkUnplayed(ctx context.Context, key float64) (*operations.Mark out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.MarkUnplayedMediaResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -240,7 +487,7 @@ func (s *Media) MarkUnplayed(ctx context.Context, key float64) (*operations.Mark // UpdatePlayProgress - Update Media Play Progress // This API command can be used to update the play progress of a media item. -func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64, state string) (*operations.UpdatePlayProgressResponse, error) { +func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64, state string, opts ...operations.Option) (*operations.UpdatePlayProgressResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "updatePlayProgress", @@ -254,12 +501,35 @@ func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64 State: state, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/:/progress") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -275,33 +545,89 @@ func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64 return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.UpdatePlayProgressResponse{ @@ -310,24 +636,26 @@ func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64 RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.UpdatePlayProgressResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -336,9 +664,531 @@ func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64 out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.UpdatePlayProgressMediaResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetBannerImage - Get Banner Image +// Gets the banner image of the media item +func (s *Media) GetBannerImage(ctx context.Context, request operations.GetBannerImageRequest, opts ...operations.Option) (*operations.GetBannerImageResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-banner-image", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/library/metadata/{ratingKey}/banner", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "image/jpeg") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetBannerImageResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + res.Headers = httpRes.Header + + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `image/jpeg`): + res.ResponseStream = httpRes.Body + + return res, nil + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetBannerImageResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetBannerImageMediaResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetThumbImage - Get Thumb Image +// Gets the thumbnail image of the media item +func (s *Media) GetThumbImage(ctx context.Context, request operations.GetThumbImageRequest, opts ...operations.Option) (*operations.GetThumbImageResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-thumb-image", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := utils.GenerateURL(ctx, baseURL, "/library/metadata/{ratingKey}/thumb", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "image/jpeg") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetThumbImageResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + res.Headers = httpRes.Header + + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `image/jpeg`): + res.ResponseStream = httpRes.Body + + return res, nil + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetThumbImageResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetThumbImageMediaResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/models/components/security.go b/models/components/security.go index a92b831..a874ed3 100644 --- a/models/components/security.go +++ b/models/components/security.go @@ -1,14 +1,14 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package components type Security struct { - AccessToken string `security:"scheme,type=apiKey,subtype=header,name=X-Plex-Token"` + AccessToken *string `security:"scheme,type=apiKey,subtype=query,name=X-Plex-Token"` } -func (o *Security) GetAccessToken() string { +func (o *Security) GetAccessToken() *string { if o == nil { - return "" + return nil } return o.AccessToken } diff --git a/models/operations/addplaylistcontents.go b/models/operations/addplaylistcontents.go index 78c4a70..c141f61 100644 --- a/models/operations/addplaylistcontents.go +++ b/models/operations/addplaylistcontents.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/applyupdates.go b/models/operations/applyupdates.go index 9864449..5f114ae 100644 --- a/models/operations/applyupdates.go +++ b/models/operations/applyupdates.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -35,7 +35,7 @@ func (e *Tonight) UnmarshalJSON(data []byte) error { } } -// Skip - Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. +// Skip - Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`. type Skip int64 const ( @@ -65,7 +65,7 @@ func (e *Skip) UnmarshalJSON(data []byte) error { type ApplyUpdatesRequest struct { // Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install Tonight *Tonight `queryParam:"style=form,explode=true,name=tonight"` - // Indicate that the latest version should be marked as skipped. The entry for this version will have the `state` set to `skipped`. + // Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`. Skip *Skip `queryParam:"style=form,explode=true,name=skip"` } diff --git a/models/operations/cancelserveractivities.go b/models/operations/cancelserveractivities.go index 9fbb11e..6659dc7 100644 --- a/models/operations/cancelserveractivities.go +++ b/models/operations/cancelserveractivities.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/checkforupdates.go b/models/operations/checkforupdates.go index fdc2d1c..6411f29 100644 --- a/models/operations/checkforupdates.go +++ b/models/operations/checkforupdates.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/clearplaylistcontents.go b/models/operations/clearplaylistcontents.go index 37af329..3127b39 100644 --- a/models/operations/clearplaylistcontents.go +++ b/models/operations/clearplaylistcontents.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/createplaylist.go b/models/operations/createplaylist.go index fcc01ba..b1d3ed4 100644 --- a/models/operations/createplaylist.go +++ b/models/operations/createplaylist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -8,19 +8,19 @@ import ( "net/http" ) -// QueryParamType - type of playlist to create -type QueryParamType string +// CreatePlaylistQueryParamType - type of playlist to create +type CreatePlaylistQueryParamType string const ( - QueryParamTypeAudio QueryParamType = "audio" - QueryParamTypeVideo QueryParamType = "video" - QueryParamTypePhoto QueryParamType = "photo" + CreatePlaylistQueryParamTypeAudio CreatePlaylistQueryParamType = "audio" + CreatePlaylistQueryParamTypeVideo CreatePlaylistQueryParamType = "video" + CreatePlaylistQueryParamTypePhoto CreatePlaylistQueryParamType = "photo" ) -func (e QueryParamType) ToPointer() *QueryParamType { +func (e CreatePlaylistQueryParamType) ToPointer() *CreatePlaylistQueryParamType { return &e } -func (e *QueryParamType) UnmarshalJSON(data []byte) error { +func (e *CreatePlaylistQueryParamType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -31,10 +31,10 @@ func (e *QueryParamType) UnmarshalJSON(data []byte) error { case "video": fallthrough case "photo": - *e = QueryParamType(v) + *e = CreatePlaylistQueryParamType(v) return nil default: - return fmt.Errorf("invalid value for QueryParamType: %v", v) + return fmt.Errorf("invalid value for CreatePlaylistQueryParamType: %v", v) } } @@ -69,7 +69,7 @@ type CreatePlaylistRequest struct { // name of the playlist Title string `queryParam:"style=form,explode=true,name=title"` // type of playlist to create - Type QueryParamType `queryParam:"style=form,explode=true,name=type"` + Type CreatePlaylistQueryParamType `queryParam:"style=form,explode=true,name=type"` // whether the playlist is smart or not Smart Smart `queryParam:"style=form,explode=true,name=smart"` // the content URI for the playlist @@ -85,9 +85,9 @@ func (o *CreatePlaylistRequest) GetTitle() string { return o.Title } -func (o *CreatePlaylistRequest) GetType() QueryParamType { +func (o *CreatePlaylistRequest) GetType() CreatePlaylistQueryParamType { if o == nil { - return QueryParamType("") + return CreatePlaylistQueryParamType("") } return o.Type } diff --git a/models/operations/deletelibrary.go b/models/operations/deletelibrary.go index 1f5d8a3..3d24361 100644 --- a/models/operations/deletelibrary.go +++ b/models/operations/deletelibrary.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -7,15 +7,17 @@ import ( ) type DeleteLibraryRequest struct { - // the Id of the library to query - SectionID float64 `pathParam:"style=simple,explode=false,name=sectionId"` + // The unique key of the Plex library. + // Note: This is unique in the context of the Plex server. + // + SectionKey int `pathParam:"style=simple,explode=false,name=sectionKey"` } -func (o *DeleteLibraryRequest) GetSectionID() float64 { +func (o *DeleteLibraryRequest) GetSectionKey() int { if o == nil { - return 0.0 + return 0 } - return o.SectionID + return o.SectionKey } type DeleteLibraryResponse struct { diff --git a/models/operations/deleteplaylist.go b/models/operations/deleteplaylist.go index 0beee02..199b937 100644 --- a/models/operations/deleteplaylist.go +++ b/models/operations/deleteplaylist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/enablepapertrail.go b/models/operations/enablepapertrail.go index f02f085..9de0163 100644 --- a/models/operations/enablepapertrail.go +++ b/models/operations/enablepapertrail.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getalllibraries.go b/models/operations/getalllibraries.go new file mode 100644 index 0000000..54a3c1f --- /dev/null +++ b/models/operations/getalllibraries.go @@ -0,0 +1,286 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "net/http" +) + +type Location struct { + ID *int `json:"id,omitempty"` + Path *string `json:"path,omitempty"` +} + +func (o *Location) GetID() *int { + if o == nil { + return nil + } + return o.ID +} + +func (o *Location) GetPath() *string { + if o == nil { + return nil + } + return o.Path +} + +type GetAllLibrariesDirectory struct { + AllowSync *bool `json:"allowSync,omitempty"` + Art *string `json:"art,omitempty"` + Composite *string `json:"composite,omitempty"` + Filters *bool `json:"filters,omitempty"` + Refreshing *bool `json:"refreshing,omitempty"` + Thumb *string `json:"thumb,omitempty"` + Key *string `json:"key,omitempty"` + Type *string `json:"type,omitempty"` + Title *string `json:"title,omitempty"` + Agent *string `json:"agent,omitempty"` + Scanner *string `json:"scanner,omitempty"` + Language *string `json:"language,omitempty"` + UUID *string `json:"uuid,omitempty"` + // Unix epoch datetime + UpdatedAt *int64 `json:"updatedAt,omitempty"` + // Unix epoch datetime + CreatedAt *int64 `json:"createdAt,omitempty"` + // Unix epoch datetime + ScannedAt *int64 `json:"scannedAt,omitempty"` + Content *bool `json:"content,omitempty"` + Directory *bool `json:"directory,omitempty"` + ContentChangedAt *int `json:"contentChangedAt,omitempty"` + Hidden *int `json:"hidden,omitempty"` + Location []Location `json:"Location,omitempty"` +} + +func (o *GetAllLibrariesDirectory) GetAllowSync() *bool { + if o == nil { + return nil + } + return o.AllowSync +} + +func (o *GetAllLibrariesDirectory) GetArt() *string { + if o == nil { + return nil + } + return o.Art +} + +func (o *GetAllLibrariesDirectory) GetComposite() *string { + if o == nil { + return nil + } + return o.Composite +} + +func (o *GetAllLibrariesDirectory) GetFilters() *bool { + if o == nil { + return nil + } + return o.Filters +} + +func (o *GetAllLibrariesDirectory) GetRefreshing() *bool { + if o == nil { + return nil + } + return o.Refreshing +} + +func (o *GetAllLibrariesDirectory) GetThumb() *string { + if o == nil { + return nil + } + return o.Thumb +} + +func (o *GetAllLibrariesDirectory) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *GetAllLibrariesDirectory) GetType() *string { + if o == nil { + return nil + } + return o.Type +} + +func (o *GetAllLibrariesDirectory) GetTitle() *string { + if o == nil { + return nil + } + return o.Title +} + +func (o *GetAllLibrariesDirectory) GetAgent() *string { + if o == nil { + return nil + } + return o.Agent +} + +func (o *GetAllLibrariesDirectory) GetScanner() *string { + if o == nil { + return nil + } + return o.Scanner +} + +func (o *GetAllLibrariesDirectory) GetLanguage() *string { + if o == nil { + return nil + } + return o.Language +} + +func (o *GetAllLibrariesDirectory) GetUUID() *string { + if o == nil { + return nil + } + return o.UUID +} + +func (o *GetAllLibrariesDirectory) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *GetAllLibrariesDirectory) GetCreatedAt() *int64 { + if o == nil { + return nil + } + return o.CreatedAt +} + +func (o *GetAllLibrariesDirectory) GetScannedAt() *int64 { + if o == nil { + return nil + } + return o.ScannedAt +} + +func (o *GetAllLibrariesDirectory) GetContent() *bool { + if o == nil { + return nil + } + return o.Content +} + +func (o *GetAllLibrariesDirectory) GetDirectory() *bool { + if o == nil { + return nil + } + return o.Directory +} + +func (o *GetAllLibrariesDirectory) GetContentChangedAt() *int { + if o == nil { + return nil + } + return o.ContentChangedAt +} + +func (o *GetAllLibrariesDirectory) GetHidden() *int { + if o == nil { + return nil + } + return o.Hidden +} + +func (o *GetAllLibrariesDirectory) GetLocation() []Location { + if o == nil { + return nil + } + return o.Location +} + +type GetAllLibrariesMediaContainer struct { + Size int `json:"size"` + AllowSync bool `json:"allowSync"` + Title1 string `json:"title1"` + Directory []GetAllLibrariesDirectory `json:"Directory,omitempty"` +} + +func (o *GetAllLibrariesMediaContainer) GetSize() int { + if o == nil { + return 0 + } + return o.Size +} + +func (o *GetAllLibrariesMediaContainer) GetAllowSync() bool { + if o == nil { + return false + } + return o.AllowSync +} + +func (o *GetAllLibrariesMediaContainer) GetTitle1() string { + if o == nil { + return "" + } + return o.Title1 +} + +func (o *GetAllLibrariesMediaContainer) GetDirectory() []GetAllLibrariesDirectory { + if o == nil { + return nil + } + return o.Directory +} + +// GetAllLibrariesResponseBody - The libraries available on the Server +type GetAllLibrariesResponseBody struct { + MediaContainer *GetAllLibrariesMediaContainer `json:"MediaContainer,omitempty"` +} + +func (o *GetAllLibrariesResponseBody) GetMediaContainer() *GetAllLibrariesMediaContainer { + if o == nil { + return nil + } + return o.MediaContainer +} + +type GetAllLibrariesResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // The libraries available on the Server + Object *GetAllLibrariesResponseBody +} + +func (o *GetAllLibrariesResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetAllLibrariesResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetAllLibrariesResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetAllLibrariesResponse) GetObject() *GetAllLibrariesResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getavailableclients.go b/models/operations/getavailableclients.go index 98b5674..cbfe0dc 100644 --- a/models/operations/getavailableclients.go +++ b/models/operations/getavailableclients.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getbandwidthstatistics.go b/models/operations/getbandwidthstatistics.go index 23d0e0b..91914b5 100644 --- a/models/operations/getbandwidthstatistics.go +++ b/models/operations/getbandwidthstatistics.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getbannerimage.go b/models/operations/getbannerimage.go new file mode 100644 index 0000000..f0350cb --- /dev/null +++ b/models/operations/getbannerimage.go @@ -0,0 +1,109 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "io" + "net/http" +) + +type GetBannerImageRequest struct { + // the id of the library item to return the children of. + RatingKey int64 `pathParam:"style=simple,explode=false,name=ratingKey"` + Width int64 `queryParam:"style=form,explode=true,name=width"` + Height int64 `queryParam:"style=form,explode=true,name=height"` + MinSize int64 `queryParam:"style=form,explode=true,name=minSize"` + Upscale int64 `queryParam:"style=form,explode=true,name=upscale"` + // Plex Authentication Token + XPlexToken string `queryParam:"style=form,explode=true,name=X-Plex-Token"` +} + +func (o *GetBannerImageRequest) GetRatingKey() int64 { + if o == nil { + return 0 + } + return o.RatingKey +} + +func (o *GetBannerImageRequest) GetWidth() int64 { + if o == nil { + return 0 + } + return o.Width +} + +func (o *GetBannerImageRequest) GetHeight() int64 { + if o == nil { + return 0 + } + return o.Height +} + +func (o *GetBannerImageRequest) GetMinSize() int64 { + if o == nil { + return 0 + } + return o.MinSize +} + +func (o *GetBannerImageRequest) GetUpscale() int64 { + if o == nil { + return 0 + } + return o.Upscale +} + +func (o *GetBannerImageRequest) GetXPlexToken() string { + if o == nil { + return "" + } + return o.XPlexToken +} + +type GetBannerImageResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successful response returning an image + // The Close method must be called on this field, even if it is not used, to prevent resource leaks. + ResponseStream io.ReadCloser + Headers map[string][]string +} + +func (o *GetBannerImageResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetBannerImageResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetBannerImageResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetBannerImageResponse) GetResponseStream() io.ReadCloser { + if o == nil { + return nil + } + return o.ResponseStream +} + +func (o *GetBannerImageResponse) GetHeaders() map[string][]string { + if o == nil { + return map[string][]string{} + } + return o.Headers +} diff --git a/models/operations/getbutlertasks.go b/models/operations/getbutlertasks.go index 7d94c99..e1d22e7 100644 --- a/models/operations/getbutlertasks.go +++ b/models/operations/getbutlertasks.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getcompanionsdata.go b/models/operations/getcompanionsdata.go new file mode 100644 index 0000000..d2711df --- /dev/null +++ b/models/operations/getcompanionsdata.go @@ -0,0 +1,102 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "net/http" +) + +var GetCompanionsDataServerList = []string{ + "https://plex.tv/api/v2/", +} + +type ResponseBody struct { + Identifier string `json:"identifier"` + BaseURL string `json:"baseURL"` + Title string `json:"title"` + LinkURL string `json:"linkURL"` + Provides string `json:"provides"` + // The plex authtoken used to identify with + Token string `json:"token"` +} + +func (o *ResponseBody) GetIdentifier() string { + if o == nil { + return "" + } + return o.Identifier +} + +func (o *ResponseBody) GetBaseURL() string { + if o == nil { + return "" + } + return o.BaseURL +} + +func (o *ResponseBody) GetTitle() string { + if o == nil { + return "" + } + return o.Title +} + +func (o *ResponseBody) GetLinkURL() string { + if o == nil { + return "" + } + return o.LinkURL +} + +func (o *ResponseBody) GetProvides() string { + if o == nil { + return "" + } + return o.Provides +} + +func (o *ResponseBody) GetToken() string { + if o == nil { + return "" + } + return o.Token +} + +type GetCompanionsDataResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Companions Data + ResponseBodies []ResponseBody +} + +func (o *GetCompanionsDataResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetCompanionsDataResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetCompanionsDataResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetCompanionsDataResponse) GetResponseBodies() []ResponseBody { + if o == nil { + return nil + } + return o.ResponseBodies +} diff --git a/models/operations/getdevices.go b/models/operations/getdevices.go index 6c07685..a69fa0b 100644 --- a/models/operations/getdevices.go +++ b/models/operations/getdevices.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getfilehash.go b/models/operations/getfilehash.go index bf63f88..90ebebe 100644 --- a/models/operations/getfilehash.go +++ b/models/operations/getfilehash.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getgeodata.go b/models/operations/getgeodata.go new file mode 100644 index 0000000..c7af2aa --- /dev/null +++ b/models/operations/getgeodata.go @@ -0,0 +1,165 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/LukeHagar/plexgo/internal/utils" + "net/http" +) + +var GetGeoDataServerList = []string{ + "https://plex.tv/api/v2/", +} + +// GetGeoDataGeoData - Geo location data +type GetGeoDataGeoData struct { + // The ISO 3166-1 alpha-2 code of the country. + Code string `json:"code"` + // The continent code where the country is located. + ContinentCode string `json:"continent_code"` + // The official name of the country. + Country string `json:"country"` + // The name of the city. + City string `json:"city"` + // Indicates if the country is a member of the European Union. + EuropeanUnionMember *bool `default:"false" json:"european_union_member"` + // The time zone of the country. + TimeZone string `json:"time_zone"` + // The postal code of the location. + PostalCode int64 `json:"postal_code"` + // Indicates if the country has privacy restrictions. + InPrivacyRestrictedCountry *bool `default:"false" json:"in_privacy_restricted_country"` + // Indicates if the region has privacy restrictions. + InPrivacyRestrictedRegion *bool `default:"false" json:"in_privacy_restricted_region"` + // The name of the primary administrative subdivision. + Subdivisions string `json:"subdivisions"` + // The geographical coordinates (latitude, longitude) of the location. + Coordinates string `json:"coordinates"` +} + +func (g GetGeoDataGeoData) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetGeoDataGeoData) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetGeoDataGeoData) GetCode() string { + if o == nil { + return "" + } + return o.Code +} + +func (o *GetGeoDataGeoData) GetContinentCode() string { + if o == nil { + return "" + } + return o.ContinentCode +} + +func (o *GetGeoDataGeoData) GetCountry() string { + if o == nil { + return "" + } + return o.Country +} + +func (o *GetGeoDataGeoData) GetCity() string { + if o == nil { + return "" + } + return o.City +} + +func (o *GetGeoDataGeoData) GetEuropeanUnionMember() *bool { + if o == nil { + return nil + } + return o.EuropeanUnionMember +} + +func (o *GetGeoDataGeoData) GetTimeZone() string { + if o == nil { + return "" + } + return o.TimeZone +} + +func (o *GetGeoDataGeoData) GetPostalCode() int64 { + if o == nil { + return 0 + } + return o.PostalCode +} + +func (o *GetGeoDataGeoData) GetInPrivacyRestrictedCountry() *bool { + if o == nil { + return nil + } + return o.InPrivacyRestrictedCountry +} + +func (o *GetGeoDataGeoData) GetInPrivacyRestrictedRegion() *bool { + if o == nil { + return nil + } + return o.InPrivacyRestrictedRegion +} + +func (o *GetGeoDataGeoData) GetSubdivisions() string { + if o == nil { + return "" + } + return o.Subdivisions +} + +func (o *GetGeoDataGeoData) GetCoordinates() string { + if o == nil { + return "" + } + return o.Coordinates +} + +type GetGeoDataResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Gets the geo location data of the user + GeoData *GetGeoDataGeoData +} + +func (o *GetGeoDataResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetGeoDataResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetGeoDataResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetGeoDataResponse) GetGeoData() *GetGeoDataGeoData { + if o == nil { + return nil + } + return o.GeoData +} diff --git a/models/operations/getglobalhubs.go b/models/operations/getglobalhubs.go index 50ca573..837f4c0 100644 --- a/models/operations/getglobalhubs.go +++ b/models/operations/getglobalhubs.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/gethomedata.go b/models/operations/gethomedata.go index 862b941..49be2b1 100644 --- a/models/operations/gethomedata.go +++ b/models/operations/gethomedata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getlibraries.go b/models/operations/getlibraries.go deleted file mode 100644 index eeacdfe..0000000 --- a/models/operations/getlibraries.go +++ /dev/null @@ -1,283 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type GetLibrariesLocation struct { - ID *int `json:"id,omitempty"` - Path *string `json:"path,omitempty"` -} - -func (o *GetLibrariesLocation) GetID() *int { - if o == nil { - return nil - } - return o.ID -} - -func (o *GetLibrariesLocation) GetPath() *string { - if o == nil { - return nil - } - return o.Path -} - -type GetLibrariesDirectory struct { - AllowSync *bool `json:"allowSync,omitempty"` - Art *string `json:"art,omitempty"` - Composite *string `json:"composite,omitempty"` - Filters *bool `json:"filters,omitempty"` - Refreshing *bool `json:"refreshing,omitempty"` - Thumb *string `json:"thumb,omitempty"` - Key *string `json:"key,omitempty"` - Type *string `json:"type,omitempty"` - Title *string `json:"title,omitempty"` - Agent *string `json:"agent,omitempty"` - Scanner *string `json:"scanner,omitempty"` - Language *string `json:"language,omitempty"` - UUID *string `json:"uuid,omitempty"` - UpdatedAt *int `json:"updatedAt,omitempty"` - CreatedAt *int `json:"createdAt,omitempty"` - ScannedAt *int `json:"scannedAt,omitempty"` - Content *bool `json:"content,omitempty"` - Directory *bool `json:"directory,omitempty"` - ContentChangedAt *int `json:"contentChangedAt,omitempty"` - Hidden *int `json:"hidden,omitempty"` - Location []GetLibrariesLocation `json:"Location,omitempty"` -} - -func (o *GetLibrariesDirectory) GetAllowSync() *bool { - if o == nil { - return nil - } - return o.AllowSync -} - -func (o *GetLibrariesDirectory) GetArt() *string { - if o == nil { - return nil - } - return o.Art -} - -func (o *GetLibrariesDirectory) GetComposite() *string { - if o == nil { - return nil - } - return o.Composite -} - -func (o *GetLibrariesDirectory) GetFilters() *bool { - if o == nil { - return nil - } - return o.Filters -} - -func (o *GetLibrariesDirectory) GetRefreshing() *bool { - if o == nil { - return nil - } - return o.Refreshing -} - -func (o *GetLibrariesDirectory) GetThumb() *string { - if o == nil { - return nil - } - return o.Thumb -} - -func (o *GetLibrariesDirectory) GetKey() *string { - if o == nil { - return nil - } - return o.Key -} - -func (o *GetLibrariesDirectory) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *GetLibrariesDirectory) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} - -func (o *GetLibrariesDirectory) GetAgent() *string { - if o == nil { - return nil - } - return o.Agent -} - -func (o *GetLibrariesDirectory) GetScanner() *string { - if o == nil { - return nil - } - return o.Scanner -} - -func (o *GetLibrariesDirectory) GetLanguage() *string { - if o == nil { - return nil - } - return o.Language -} - -func (o *GetLibrariesDirectory) GetUUID() *string { - if o == nil { - return nil - } - return o.UUID -} - -func (o *GetLibrariesDirectory) GetUpdatedAt() *int { - if o == nil { - return nil - } - return o.UpdatedAt -} - -func (o *GetLibrariesDirectory) GetCreatedAt() *int { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *GetLibrariesDirectory) GetScannedAt() *int { - if o == nil { - return nil - } - return o.ScannedAt -} - -func (o *GetLibrariesDirectory) GetContent() *bool { - if o == nil { - return nil - } - return o.Content -} - -func (o *GetLibrariesDirectory) GetDirectory() *bool { - if o == nil { - return nil - } - return o.Directory -} - -func (o *GetLibrariesDirectory) GetContentChangedAt() *int { - if o == nil { - return nil - } - return o.ContentChangedAt -} - -func (o *GetLibrariesDirectory) GetHidden() *int { - if o == nil { - return nil - } - return o.Hidden -} - -func (o *GetLibrariesDirectory) GetLocation() []GetLibrariesLocation { - if o == nil { - return nil - } - return o.Location -} - -type GetLibrariesMediaContainer struct { - Size *int `json:"size,omitempty"` - AllowSync *bool `json:"allowSync,omitempty"` - Title1 *string `json:"title1,omitempty"` - Directory []GetLibrariesDirectory `json:"Directory,omitempty"` -} - -func (o *GetLibrariesMediaContainer) GetSize() *int { - if o == nil { - return nil - } - return o.Size -} - -func (o *GetLibrariesMediaContainer) GetAllowSync() *bool { - if o == nil { - return nil - } - return o.AllowSync -} - -func (o *GetLibrariesMediaContainer) GetTitle1() *string { - if o == nil { - return nil - } - return o.Title1 -} - -func (o *GetLibrariesMediaContainer) GetDirectory() []GetLibrariesDirectory { - if o == nil { - return nil - } - return o.Directory -} - -// GetLibrariesResponseBody - The libraries available on the Server -type GetLibrariesResponseBody struct { - MediaContainer *GetLibrariesMediaContainer `json:"MediaContainer,omitempty"` -} - -func (o *GetLibrariesResponseBody) GetMediaContainer() *GetLibrariesMediaContainer { - if o == nil { - return nil - } - return o.MediaContainer -} - -type GetLibrariesResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // The libraries available on the Server - Object *GetLibrariesResponseBody -} - -func (o *GetLibrariesResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetLibrariesResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetLibrariesResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetLibrariesResponse) GetObject() *GetLibrariesResponseBody { - if o == nil { - return nil - } - return o.Object -} diff --git a/models/operations/getlibrary.go b/models/operations/getlibrarydetails.go similarity index 55% rename from models/operations/getlibrary.go rename to models/operations/getlibrarydetails.go index 67c4094..d6fb442 100644 --- a/models/operations/getlibrary.go +++ b/models/operations/getlibrarydetails.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -37,41 +37,43 @@ func (e *IncludeDetails) UnmarshalJSON(data []byte) error { } } -type GetLibraryRequest struct { - // the Id of the library to query - SectionID float64 `pathParam:"style=simple,explode=false,name=sectionId"` +type GetLibraryDetailsRequest struct { + // The unique key of the Plex library. + // Note: This is unique in the context of the Plex server. + // + SectionKey int `pathParam:"style=simple,explode=false,name=sectionKey"` // Whether or not to include details for a section (types, filters, and sorts). // Only exists for backwards compatibility, media providers other than the server libraries have it on always. // IncludeDetails *IncludeDetails `default:"0" queryParam:"style=form,explode=true,name=includeDetails"` } -func (g GetLibraryRequest) MarshalJSON() ([]byte, error) { +func (g GetLibraryDetailsRequest) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(g, "", false) } -func (g *GetLibraryRequest) UnmarshalJSON(data []byte) error { +func (g *GetLibraryDetailsRequest) UnmarshalJSON(data []byte) error { if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { return err } return nil } -func (o *GetLibraryRequest) GetSectionID() float64 { +func (o *GetLibraryDetailsRequest) GetSectionKey() int { if o == nil { - return 0.0 + return 0 } - return o.SectionID + return o.SectionKey } -func (o *GetLibraryRequest) GetIncludeDetails() *IncludeDetails { +func (o *GetLibraryDetailsRequest) GetIncludeDetails() *IncludeDetails { if o == nil { return nil } return o.IncludeDetails } -type GetLibraryDirectory struct { +type GetLibraryDetailsDirectory struct { Key *string `json:"key,omitempty"` Title *string `json:"title,omitempty"` Secondary *bool `json:"secondary,omitempty"` @@ -79,42 +81,42 @@ type GetLibraryDirectory struct { Search *bool `json:"search,omitempty"` } -func (o *GetLibraryDirectory) GetKey() *string { +func (o *GetLibraryDetailsDirectory) GetKey() *string { if o == nil { return nil } return o.Key } -func (o *GetLibraryDirectory) GetTitle() *string { +func (o *GetLibraryDetailsDirectory) GetTitle() *string { if o == nil { return nil } return o.Title } -func (o *GetLibraryDirectory) GetSecondary() *bool { +func (o *GetLibraryDetailsDirectory) GetSecondary() *bool { if o == nil { return nil } return o.Secondary } -func (o *GetLibraryDirectory) GetPrompt() *string { +func (o *GetLibraryDetailsDirectory) GetPrompt() *string { if o == nil { return nil } return o.Prompt } -func (o *GetLibraryDirectory) GetSearch() *bool { +func (o *GetLibraryDetailsDirectory) GetSearch() *bool { if o == nil { return nil } return o.Search } -type GetLibraryFilter struct { +type GetLibraryDetailsFilter struct { Filter *string `json:"filter,omitempty"` FilterType *string `json:"filterType,omitempty"` Key *string `json:"key,omitempty"` @@ -122,35 +124,35 @@ type GetLibraryFilter struct { Type *string `json:"type,omitempty"` } -func (o *GetLibraryFilter) GetFilter() *string { +func (o *GetLibraryDetailsFilter) GetFilter() *string { if o == nil { return nil } return o.Filter } -func (o *GetLibraryFilter) GetFilterType() *string { +func (o *GetLibraryDetailsFilter) GetFilterType() *string { if o == nil { return nil } return o.FilterType } -func (o *GetLibraryFilter) GetKey() *string { +func (o *GetLibraryDetailsFilter) GetKey() *string { if o == nil { return nil } return o.Key } -func (o *GetLibraryFilter) GetTitle() *string { +func (o *GetLibraryDetailsFilter) GetTitle() *string { if o == nil { return nil } return o.Title } -func (o *GetLibraryFilter) GetType() *string { +func (o *GetLibraryDetailsFilter) GetType() *string { if o == nil { return nil } @@ -243,59 +245,59 @@ func (o *Field) GetSubType() *string { return o.SubType } -type GetLibraryType struct { - Key *string `json:"key,omitempty"` - Type *string `json:"type,omitempty"` - Title *string `json:"title,omitempty"` - Active *bool `json:"active,omitempty"` - Filter []GetLibraryFilter `json:"Filter,omitempty"` - Sort []Sort `json:"Sort,omitempty"` - Field []Field `json:"Field,omitempty"` +type GetLibraryDetailsType struct { + Key *string `json:"key,omitempty"` + Type *string `json:"type,omitempty"` + Title *string `json:"title,omitempty"` + Active *bool `json:"active,omitempty"` + Filter []GetLibraryDetailsFilter `json:"Filter,omitempty"` + Sort []Sort `json:"Sort,omitempty"` + Field []Field `json:"Field,omitempty"` } -func (o *GetLibraryType) GetKey() *string { +func (o *GetLibraryDetailsType) GetKey() *string { if o == nil { return nil } return o.Key } -func (o *GetLibraryType) GetType() *string { +func (o *GetLibraryDetailsType) GetType() *string { if o == nil { return nil } return o.Type } -func (o *GetLibraryType) GetTitle() *string { +func (o *GetLibraryDetailsType) GetTitle() *string { if o == nil { return nil } return o.Title } -func (o *GetLibraryType) GetActive() *bool { +func (o *GetLibraryDetailsType) GetActive() *bool { if o == nil { return nil } return o.Active } -func (o *GetLibraryType) GetFilter() []GetLibraryFilter { +func (o *GetLibraryDetailsType) GetFilter() []GetLibraryDetailsFilter { if o == nil { return nil } return o.Filter } -func (o *GetLibraryType) GetSort() []Sort { +func (o *GetLibraryDetailsType) GetSort() []Sort { if o == nil { return nil } return o.Sort } -func (o *GetLibraryType) GetField() []Field { +func (o *GetLibraryDetailsType) GetField() []Field { if o == nil { return nil } @@ -340,142 +342,142 @@ func (o *FieldType) GetOperator() []Operator { return o.Operator } -type GetLibraryMediaContainer struct { - Size *int `json:"size,omitempty"` - AllowSync *bool `json:"allowSync,omitempty"` - Art *string `json:"art,omitempty"` - Content *string `json:"content,omitempty"` - Identifier *string `json:"identifier,omitempty"` - LibrarySectionID *int `json:"librarySectionID,omitempty"` - MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"` - MediaTagVersion *int `json:"mediaTagVersion,omitempty"` - Thumb *string `json:"thumb,omitempty"` - Title1 *string `json:"title1,omitempty"` - ViewGroup *string `json:"viewGroup,omitempty"` - ViewMode *int `json:"viewMode,omitempty"` - Directory []GetLibraryDirectory `json:"Directory,omitempty"` - Type []GetLibraryType `json:"Type,omitempty"` - FieldType []FieldType `json:"FieldType,omitempty"` +type GetLibraryDetailsMediaContainer struct { + Size *int `json:"size,omitempty"` + AllowSync *bool `json:"allowSync,omitempty"` + Art *string `json:"art,omitempty"` + Content *string `json:"content,omitempty"` + Identifier *string `json:"identifier,omitempty"` + LibrarySectionID *int `json:"librarySectionID,omitempty"` + MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"` + MediaTagVersion *int `json:"mediaTagVersion,omitempty"` + Thumb *string `json:"thumb,omitempty"` + Title1 *string `json:"title1,omitempty"` + ViewGroup *string `json:"viewGroup,omitempty"` + ViewMode *int `json:"viewMode,omitempty"` + Directory []GetLibraryDetailsDirectory `json:"Directory,omitempty"` + Type []GetLibraryDetailsType `json:"Type,omitempty"` + FieldType []FieldType `json:"FieldType,omitempty"` } -func (o *GetLibraryMediaContainer) GetSize() *int { +func (o *GetLibraryDetailsMediaContainer) GetSize() *int { if o == nil { return nil } return o.Size } -func (o *GetLibraryMediaContainer) GetAllowSync() *bool { +func (o *GetLibraryDetailsMediaContainer) GetAllowSync() *bool { if o == nil { return nil } return o.AllowSync } -func (o *GetLibraryMediaContainer) GetArt() *string { +func (o *GetLibraryDetailsMediaContainer) GetArt() *string { if o == nil { return nil } return o.Art } -func (o *GetLibraryMediaContainer) GetContent() *string { +func (o *GetLibraryDetailsMediaContainer) GetContent() *string { if o == nil { return nil } return o.Content } -func (o *GetLibraryMediaContainer) GetIdentifier() *string { +func (o *GetLibraryDetailsMediaContainer) GetIdentifier() *string { if o == nil { return nil } return o.Identifier } -func (o *GetLibraryMediaContainer) GetLibrarySectionID() *int { +func (o *GetLibraryDetailsMediaContainer) GetLibrarySectionID() *int { if o == nil { return nil } return o.LibrarySectionID } -func (o *GetLibraryMediaContainer) GetMediaTagPrefix() *string { +func (o *GetLibraryDetailsMediaContainer) GetMediaTagPrefix() *string { if o == nil { return nil } return o.MediaTagPrefix } -func (o *GetLibraryMediaContainer) GetMediaTagVersion() *int { +func (o *GetLibraryDetailsMediaContainer) GetMediaTagVersion() *int { if o == nil { return nil } return o.MediaTagVersion } -func (o *GetLibraryMediaContainer) GetThumb() *string { +func (o *GetLibraryDetailsMediaContainer) GetThumb() *string { if o == nil { return nil } return o.Thumb } -func (o *GetLibraryMediaContainer) GetTitle1() *string { +func (o *GetLibraryDetailsMediaContainer) GetTitle1() *string { if o == nil { return nil } return o.Title1 } -func (o *GetLibraryMediaContainer) GetViewGroup() *string { +func (o *GetLibraryDetailsMediaContainer) GetViewGroup() *string { if o == nil { return nil } return o.ViewGroup } -func (o *GetLibraryMediaContainer) GetViewMode() *int { +func (o *GetLibraryDetailsMediaContainer) GetViewMode() *int { if o == nil { return nil } return o.ViewMode } -func (o *GetLibraryMediaContainer) GetDirectory() []GetLibraryDirectory { +func (o *GetLibraryDetailsMediaContainer) GetDirectory() []GetLibraryDetailsDirectory { if o == nil { return nil } return o.Directory } -func (o *GetLibraryMediaContainer) GetType() []GetLibraryType { +func (o *GetLibraryDetailsMediaContainer) GetType() []GetLibraryDetailsType { if o == nil { return nil } return o.Type } -func (o *GetLibraryMediaContainer) GetFieldType() []FieldType { +func (o *GetLibraryDetailsMediaContainer) GetFieldType() []FieldType { if o == nil { return nil } return o.FieldType } -// GetLibraryResponseBody - The details of the library -type GetLibraryResponseBody struct { - MediaContainer *GetLibraryMediaContainer `json:"MediaContainer,omitempty"` +// GetLibraryDetailsResponseBody - The details of the library +type GetLibraryDetailsResponseBody struct { + MediaContainer *GetLibraryDetailsMediaContainer `json:"MediaContainer,omitempty"` } -func (o *GetLibraryResponseBody) GetMediaContainer() *GetLibraryMediaContainer { +func (o *GetLibraryDetailsResponseBody) GetMediaContainer() *GetLibraryDetailsMediaContainer { if o == nil { return nil } return o.MediaContainer } -type GetLibraryResponse struct { +type GetLibraryDetailsResponse struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation @@ -483,31 +485,31 @@ type GetLibraryResponse struct { // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // The details of the library - Object *GetLibraryResponseBody + Object *GetLibraryDetailsResponseBody } -func (o *GetLibraryResponse) GetContentType() string { +func (o *GetLibraryDetailsResponse) GetContentType() string { if o == nil { return "" } return o.ContentType } -func (o *GetLibraryResponse) GetStatusCode() int { +func (o *GetLibraryDetailsResponse) GetStatusCode() int { if o == nil { return 0 } return o.StatusCode } -func (o *GetLibraryResponse) GetRawResponse() *http.Response { +func (o *GetLibraryDetailsResponse) GetRawResponse() *http.Response { if o == nil { return nil } return o.RawResponse } -func (o *GetLibraryResponse) GetObject() *GetLibraryResponseBody { +func (o *GetLibraryDetailsResponse) GetObject() *GetLibraryDetailsResponseBody { if o == nil { return nil } diff --git a/models/operations/getlibraryhubs.go b/models/operations/getlibraryhubs.go index bbd5968..22c3b7b 100644 --- a/models/operations/getlibraryhubs.go +++ b/models/operations/getlibraryhubs.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getlibraryitems.go b/models/operations/getlibraryitems.go index 5078b59..e7ada63 100644 --- a/models/operations/getlibraryitems.go +++ b/models/operations/getlibraryitems.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -89,21 +89,147 @@ func (e *Tag) UnmarshalJSON(data []byte) error { } } +// IncludeGuids - Adds the Guids object to the response +type IncludeGuids int64 + +const ( + IncludeGuidsZero IncludeGuids = 0 + IncludeGuidsOne IncludeGuids = 1 +) + +func (e IncludeGuids) ToPointer() *IncludeGuids { + return &e +} +func (e *IncludeGuids) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 0: + fallthrough + case 1: + *e = IncludeGuids(v) + return nil + default: + return fmt.Errorf("invalid value for IncludeGuids: %v", v) + } +} + +// IncludeMeta - Adds the Meta object to the response +type IncludeMeta int64 + +const ( + IncludeMetaZero IncludeMeta = 0 + IncludeMetaOne IncludeMeta = 1 +) + +func (e IncludeMeta) ToPointer() *IncludeMeta { + return &e +} +func (e *IncludeMeta) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 0: + fallthrough + case 1: + *e = IncludeMeta(v) + return nil + default: + return fmt.Errorf("invalid value for IncludeMeta: %v", v) + } +} + +// Type - The type of media to retrieve. +// 1 = movie +// 2 = show +// 3 = season +// 4 = episode +// E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries +type Type int64 + +const ( + TypeOne Type = 1 + TypeTwo Type = 2 + TypeThree Type = 3 + TypeFour Type = 4 +) + +func (e Type) ToPointer() *Type { + return &e +} +func (e *Type) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 1: + fallthrough + case 2: + fallthrough + case 3: + fallthrough + case 4: + *e = Type(v) + return nil + default: + return fmt.Errorf("invalid value for Type: %v", v) + } +} + type GetLibraryItemsRequest struct { - // the Id of the library to query - SectionID any `pathParam:"style=simple,explode=false,name=sectionId"` + // The unique key of the Plex library. + // Note: This is unique in the context of the Plex server. + // + SectionKey int `pathParam:"style=simple,explode=false,name=sectionKey"` // A key representing a specific tag within the section. Tag Tag `pathParam:"style=simple,explode=false,name=tag"` // Adds the Guids object to the response // - IncludeGuids *int64 `queryParam:"style=form,explode=true,name=includeGuids"` + IncludeGuids *IncludeGuids `queryParam:"style=form,explode=true,name=includeGuids"` + // Adds the Meta object to the response + // + IncludeMeta *IncludeMeta `queryParam:"style=form,explode=true,name=includeMeta"` + // The type of media to retrieve. + // 1 = movie + // 2 = show + // 3 = season + // 4 = episode + // E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries + // + Type Type `queryParam:"style=form,explode=true,name=type"` + // The index of the first item to return. If not specified, the first item will be returned. + // If the number of items exceeds the limit, the response will be paginated. + // By default this is 0 + // + XPlexContainerStart *int `default:"0" queryParam:"style=form,explode=true,name=X-Plex-Container-Start"` + // The number of items to return. If not specified, all items will be returned. + // If the number of items exceeds the limit, the response will be paginated. + // By default this is 50 + // + XPlexContainerSize *int `default:"50" queryParam:"style=form,explode=true,name=X-Plex-Container-Size"` } -func (o *GetLibraryItemsRequest) GetSectionID() any { - if o == nil { - return nil +func (g GetLibraryItemsRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetLibraryItemsRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err } - return o.SectionID + return nil +} + +func (o *GetLibraryItemsRequest) GetSectionKey() int { + if o == nil { + return 0 + } + return o.SectionKey } func (o *GetLibraryItemsRequest) GetTag() Tag { @@ -113,13 +239,41 @@ func (o *GetLibraryItemsRequest) GetTag() Tag { return o.Tag } -func (o *GetLibraryItemsRequest) GetIncludeGuids() *int64 { +func (o *GetLibraryItemsRequest) GetIncludeGuids() *IncludeGuids { if o == nil { return nil } return o.IncludeGuids } +func (o *GetLibraryItemsRequest) GetIncludeMeta() *IncludeMeta { + if o == nil { + return nil + } + return o.IncludeMeta +} + +func (o *GetLibraryItemsRequest) GetType() Type { + if o == nil { + return Type(0) + } + return o.Type +} + +func (o *GetLibraryItemsRequest) GetXPlexContainerStart() *int { + if o == nil { + return nil + } + return o.XPlexContainerStart +} + +func (o *GetLibraryItemsRequest) GetXPlexContainerSize() *int { + if o == nil { + return nil + } + return o.XPlexContainerSize +} + type LibrarySectionIDType string const ( diff --git a/models/operations/getmediaproviders.go b/models/operations/getmediaproviders.go new file mode 100644 index 0000000..1e871f7 --- /dev/null +++ b/models/operations/getmediaproviders.go @@ -0,0 +1,661 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "net/http" +) + +type GetMediaProvidersRequest struct { + // Plex Authentication Token + XPlexToken string `queryParam:"style=form,explode=true,name=X-Plex-Token"` +} + +func (o *GetMediaProvidersRequest) GetXPlexToken() string { + if o == nil { + return "" + } + return o.XPlexToken +} + +type Pivot struct { + ID *string `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + Type *string `json:"type,omitempty"` + Title *string `json:"title,omitempty"` + Context *string `json:"context,omitempty"` + Symbol *string `json:"symbol,omitempty"` +} + +func (o *Pivot) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *Pivot) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *Pivot) GetType() *string { + if o == nil { + return nil + } + return o.Type +} + +func (o *Pivot) GetTitle() *string { + if o == nil { + return nil + } + return o.Title +} + +func (o *Pivot) GetContext() *string { + if o == nil { + return nil + } + return o.Context +} + +func (o *Pivot) GetSymbol() *string { + if o == nil { + return nil + } + return o.Symbol +} + +type GetMediaProvidersDirectory struct { + HubKey *string `json:"hubKey,omitempty"` + Title *string `json:"title,omitempty"` + Agent *string `json:"agent,omitempty"` + Language *string `json:"language,omitempty"` + Refreshing *bool `json:"refreshing,omitempty"` + Scanner *string `json:"scanner,omitempty"` + UUID *string `json:"uuid,omitempty"` + ID *string `json:"id,omitempty"` + Key *string `json:"key,omitempty"` + Type *string `json:"type,omitempty"` + Subtype *string `json:"subtype,omitempty"` + UpdatedAt *int64 `json:"updatedAt,omitempty"` + ScannedAt *int64 `json:"scannedAt,omitempty"` + Pivot []Pivot `json:"Pivot,omitempty"` +} + +func (o *GetMediaProvidersDirectory) GetHubKey() *string { + if o == nil { + return nil + } + return o.HubKey +} + +func (o *GetMediaProvidersDirectory) GetTitle() *string { + if o == nil { + return nil + } + return o.Title +} + +func (o *GetMediaProvidersDirectory) GetAgent() *string { + if o == nil { + return nil + } + return o.Agent +} + +func (o *GetMediaProvidersDirectory) GetLanguage() *string { + if o == nil { + return nil + } + return o.Language +} + +func (o *GetMediaProvidersDirectory) GetRefreshing() *bool { + if o == nil { + return nil + } + return o.Refreshing +} + +func (o *GetMediaProvidersDirectory) GetScanner() *string { + if o == nil { + return nil + } + return o.Scanner +} + +func (o *GetMediaProvidersDirectory) GetUUID() *string { + if o == nil { + return nil + } + return o.UUID +} + +func (o *GetMediaProvidersDirectory) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *GetMediaProvidersDirectory) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *GetMediaProvidersDirectory) GetType() *string { + if o == nil { + return nil + } + return o.Type +} + +func (o *GetMediaProvidersDirectory) GetSubtype() *string { + if o == nil { + return nil + } + return o.Subtype +} + +func (o *GetMediaProvidersDirectory) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *GetMediaProvidersDirectory) GetScannedAt() *int64 { + if o == nil { + return nil + } + return o.ScannedAt +} + +func (o *GetMediaProvidersDirectory) GetPivot() []Pivot { + if o == nil { + return nil + } + return o.Pivot +} + +type Feature struct { + Key *string `json:"key,omitempty"` + Type *string `json:"type,omitempty"` + Directory []GetMediaProvidersDirectory `json:"Directory,omitempty"` +} + +func (o *Feature) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *Feature) GetType() *string { + if o == nil { + return nil + } + return o.Type +} + +func (o *Feature) GetDirectory() []GetMediaProvidersDirectory { + if o == nil { + return nil + } + return o.Directory +} + +type MediaProvider struct { + Identifier *string `json:"identifier,omitempty"` + Title *string `json:"title,omitempty"` + Types *string `json:"types,omitempty"` + Protocols *string `json:"protocols,omitempty"` + Feature []Feature `json:"Feature,omitempty"` +} + +func (o *MediaProvider) GetIdentifier() *string { + if o == nil { + return nil + } + return o.Identifier +} + +func (o *MediaProvider) GetTitle() *string { + if o == nil { + return nil + } + return o.Title +} + +func (o *MediaProvider) GetTypes() *string { + if o == nil { + return nil + } + return o.Types +} + +func (o *MediaProvider) GetProtocols() *string { + if o == nil { + return nil + } + return o.Protocols +} + +func (o *MediaProvider) GetFeature() []Feature { + if o == nil { + return nil + } + return o.Feature +} + +type GetMediaProvidersMediaContainer struct { + Size *int64 `json:"size,omitempty"` + AllowCameraUpload *bool `json:"allowCameraUpload,omitempty"` + AllowChannelAccess *bool `json:"allowChannelAccess,omitempty"` + AllowSharing *bool `json:"allowSharing,omitempty"` + AllowSync *bool `json:"allowSync,omitempty"` + AllowTuners *bool `json:"allowTuners,omitempty"` + BackgroundProcessing *bool `json:"backgroundProcessing,omitempty"` + Certificate *bool `json:"certificate,omitempty"` + CompanionProxy *bool `json:"companionProxy,omitempty"` + CountryCode *string `json:"countryCode,omitempty"` + Diagnostics *string `json:"diagnostics,omitempty"` + EventStream *bool `json:"eventStream,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + Livetv *int64 `json:"livetv,omitempty"` + MachineIdentifier *string `json:"machineIdentifier,omitempty"` + MusicAnalysis *int64 `json:"musicAnalysis,omitempty"` + MyPlex *bool `json:"myPlex,omitempty"` + MyPlexMappingState *string `json:"myPlexMappingState,omitempty"` + MyPlexSigninState *string `json:"myPlexSigninState,omitempty"` + MyPlexSubscription *bool `json:"myPlexSubscription,omitempty"` + MyPlexUsername *string `json:"myPlexUsername,omitempty"` + OfflineTranscode *int64 `json:"offlineTranscode,omitempty"` + OwnerFeatures *string `json:"ownerFeatures,omitempty"` + Platform *string `json:"platform,omitempty"` + PlatformVersion *string `json:"platformVersion,omitempty"` + PluginHost *bool `json:"pluginHost,omitempty"` + PushNotifications *bool `json:"pushNotifications,omitempty"` + ReadOnlyLibraries *bool `json:"readOnlyLibraries,omitempty"` + StreamingBrainABRVersion *int64 `json:"streamingBrainABRVersion,omitempty"` + StreamingBrainVersion *int64 `json:"streamingBrainVersion,omitempty"` + Sync *bool `json:"sync,omitempty"` + TranscoderActiveVideoSessions *int64 `json:"transcoderActiveVideoSessions,omitempty"` + TranscoderAudio *bool `json:"transcoderAudio,omitempty"` + TranscoderLyrics *bool `json:"transcoderLyrics,omitempty"` + TranscoderSubtitles *bool `json:"transcoderSubtitles,omitempty"` + TranscoderVideo *bool `json:"transcoderVideo,omitempty"` + TranscoderVideoBitrates *string `json:"transcoderVideoBitrates,omitempty"` + TranscoderVideoQualities *string `json:"transcoderVideoQualities,omitempty"` + TranscoderVideoResolutions *string `json:"transcoderVideoResolutions,omitempty"` + UpdatedAt *int64 `json:"updatedAt,omitempty"` + Updater *bool `json:"updater,omitempty"` + Version *string `json:"version,omitempty"` + VoiceSearch *bool `json:"voiceSearch,omitempty"` + MediaProvider []MediaProvider `json:"MediaProvider,omitempty"` +} + +func (o *GetMediaProvidersMediaContainer) GetSize() *int64 { + if o == nil { + return nil + } + return o.Size +} + +func (o *GetMediaProvidersMediaContainer) GetAllowCameraUpload() *bool { + if o == nil { + return nil + } + return o.AllowCameraUpload +} + +func (o *GetMediaProvidersMediaContainer) GetAllowChannelAccess() *bool { + if o == nil { + return nil + } + return o.AllowChannelAccess +} + +func (o *GetMediaProvidersMediaContainer) GetAllowSharing() *bool { + if o == nil { + return nil + } + return o.AllowSharing +} + +func (o *GetMediaProvidersMediaContainer) GetAllowSync() *bool { + if o == nil { + return nil + } + return o.AllowSync +} + +func (o *GetMediaProvidersMediaContainer) GetAllowTuners() *bool { + if o == nil { + return nil + } + return o.AllowTuners +} + +func (o *GetMediaProvidersMediaContainer) GetBackgroundProcessing() *bool { + if o == nil { + return nil + } + return o.BackgroundProcessing +} + +func (o *GetMediaProvidersMediaContainer) GetCertificate() *bool { + if o == nil { + return nil + } + return o.Certificate +} + +func (o *GetMediaProvidersMediaContainer) GetCompanionProxy() *bool { + if o == nil { + return nil + } + return o.CompanionProxy +} + +func (o *GetMediaProvidersMediaContainer) GetCountryCode() *string { + if o == nil { + return nil + } + return o.CountryCode +} + +func (o *GetMediaProvidersMediaContainer) GetDiagnostics() *string { + if o == nil { + return nil + } + return o.Diagnostics +} + +func (o *GetMediaProvidersMediaContainer) GetEventStream() *bool { + if o == nil { + return nil + } + return o.EventStream +} + +func (o *GetMediaProvidersMediaContainer) GetFriendlyName() *string { + if o == nil { + return nil + } + return o.FriendlyName +} + +func (o *GetMediaProvidersMediaContainer) GetLivetv() *int64 { + if o == nil { + return nil + } + return o.Livetv +} + +func (o *GetMediaProvidersMediaContainer) GetMachineIdentifier() *string { + if o == nil { + return nil + } + return o.MachineIdentifier +} + +func (o *GetMediaProvidersMediaContainer) GetMusicAnalysis() *int64 { + if o == nil { + return nil + } + return o.MusicAnalysis +} + +func (o *GetMediaProvidersMediaContainer) GetMyPlex() *bool { + if o == nil { + return nil + } + return o.MyPlex +} + +func (o *GetMediaProvidersMediaContainer) GetMyPlexMappingState() *string { + if o == nil { + return nil + } + return o.MyPlexMappingState +} + +func (o *GetMediaProvidersMediaContainer) GetMyPlexSigninState() *string { + if o == nil { + return nil + } + return o.MyPlexSigninState +} + +func (o *GetMediaProvidersMediaContainer) GetMyPlexSubscription() *bool { + if o == nil { + return nil + } + return o.MyPlexSubscription +} + +func (o *GetMediaProvidersMediaContainer) GetMyPlexUsername() *string { + if o == nil { + return nil + } + return o.MyPlexUsername +} + +func (o *GetMediaProvidersMediaContainer) GetOfflineTranscode() *int64 { + if o == nil { + return nil + } + return o.OfflineTranscode +} + +func (o *GetMediaProvidersMediaContainer) GetOwnerFeatures() *string { + if o == nil { + return nil + } + return o.OwnerFeatures +} + +func (o *GetMediaProvidersMediaContainer) GetPlatform() *string { + if o == nil { + return nil + } + return o.Platform +} + +func (o *GetMediaProvidersMediaContainer) GetPlatformVersion() *string { + if o == nil { + return nil + } + return o.PlatformVersion +} + +func (o *GetMediaProvidersMediaContainer) GetPluginHost() *bool { + if o == nil { + return nil + } + return o.PluginHost +} + +func (o *GetMediaProvidersMediaContainer) GetPushNotifications() *bool { + if o == nil { + return nil + } + return o.PushNotifications +} + +func (o *GetMediaProvidersMediaContainer) GetReadOnlyLibraries() *bool { + if o == nil { + return nil + } + return o.ReadOnlyLibraries +} + +func (o *GetMediaProvidersMediaContainer) GetStreamingBrainABRVersion() *int64 { + if o == nil { + return nil + } + return o.StreamingBrainABRVersion +} + +func (o *GetMediaProvidersMediaContainer) GetStreamingBrainVersion() *int64 { + if o == nil { + return nil + } + return o.StreamingBrainVersion +} + +func (o *GetMediaProvidersMediaContainer) GetSync() *bool { + if o == nil { + return nil + } + return o.Sync +} + +func (o *GetMediaProvidersMediaContainer) GetTranscoderActiveVideoSessions() *int64 { + if o == nil { + return nil + } + return o.TranscoderActiveVideoSessions +} + +func (o *GetMediaProvidersMediaContainer) GetTranscoderAudio() *bool { + if o == nil { + return nil + } + return o.TranscoderAudio +} + +func (o *GetMediaProvidersMediaContainer) GetTranscoderLyrics() *bool { + if o == nil { + return nil + } + return o.TranscoderLyrics +} + +func (o *GetMediaProvidersMediaContainer) GetTranscoderSubtitles() *bool { + if o == nil { + return nil + } + return o.TranscoderSubtitles +} + +func (o *GetMediaProvidersMediaContainer) GetTranscoderVideo() *bool { + if o == nil { + return nil + } + return o.TranscoderVideo +} + +func (o *GetMediaProvidersMediaContainer) GetTranscoderVideoBitrates() *string { + if o == nil { + return nil + } + return o.TranscoderVideoBitrates +} + +func (o *GetMediaProvidersMediaContainer) GetTranscoderVideoQualities() *string { + if o == nil { + return nil + } + return o.TranscoderVideoQualities +} + +func (o *GetMediaProvidersMediaContainer) GetTranscoderVideoResolutions() *string { + if o == nil { + return nil + } + return o.TranscoderVideoResolutions +} + +func (o *GetMediaProvidersMediaContainer) GetUpdatedAt() *int64 { + if o == nil { + return nil + } + return o.UpdatedAt +} + +func (o *GetMediaProvidersMediaContainer) GetUpdater() *bool { + if o == nil { + return nil + } + return o.Updater +} + +func (o *GetMediaProvidersMediaContainer) GetVersion() *string { + if o == nil { + return nil + } + return o.Version +} + +func (o *GetMediaProvidersMediaContainer) GetVoiceSearch() *bool { + if o == nil { + return nil + } + return o.VoiceSearch +} + +func (o *GetMediaProvidersMediaContainer) GetMediaProvider() []MediaProvider { + if o == nil { + return nil + } + return o.MediaProvider +} + +// GetMediaProvidersResponseBody - Media providers and their features +type GetMediaProvidersResponseBody struct { + MediaContainer *GetMediaProvidersMediaContainer `json:"MediaContainer,omitempty"` +} + +func (o *GetMediaProvidersResponseBody) GetMediaContainer() *GetMediaProvidersMediaContainer { + if o == nil { + return nil + } + return o.MediaContainer +} + +type GetMediaProvidersResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Media providers and their features + Object *GetMediaProvidersResponseBody +} + +func (o *GetMediaProvidersResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetMediaProvidersResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetMediaProvidersResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetMediaProvidersResponse) GetObject() *GetMediaProvidersResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getmetadata.go b/models/operations/getmetadatabyratingkey.go similarity index 52% rename from models/operations/getmetadata.go rename to models/operations/getmetadatabyratingkey.go index c359e9e..f2419c3 100644 --- a/models/operations/getmetadata.go +++ b/models/operations/getmetadatabyratingkey.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -8,14 +8,14 @@ import ( "net/http" ) -type GetMetadataRequest struct { +type GetMetaDataByRatingKeyRequest struct { // the id of the library item to return the children of. - RatingKey float64 `pathParam:"style=simple,explode=false,name=ratingKey"` + RatingKey int64 `pathParam:"style=simple,explode=false,name=ratingKey"` } -func (o *GetMetadataRequest) GetRatingKey() float64 { +func (o *GetMetaDataByRatingKeyRequest) GetRatingKey() int64 { if o == nil { - return 0.0 + return 0 } return o.RatingKey } @@ -279,7 +279,7 @@ func (o *Stream) GetSamplingRate() *int { return o.SamplingRate } -type GetMetadataPart struct { +type GetMetaDataByRatingKeyPart struct { ID *int `json:"id,omitempty"` Key *string `json:"key,omitempty"` Duration *int `json:"duration,omitempty"` @@ -293,270 +293,270 @@ type GetMetadataPart struct { Stream []Stream `json:"Stream,omitempty"` } -func (o *GetMetadataPart) GetID() *int { +func (o *GetMetaDataByRatingKeyPart) GetID() *int { if o == nil { return nil } return o.ID } -func (o *GetMetadataPart) GetKey() *string { +func (o *GetMetaDataByRatingKeyPart) GetKey() *string { if o == nil { return nil } return o.Key } -func (o *GetMetadataPart) GetDuration() *int { +func (o *GetMetaDataByRatingKeyPart) GetDuration() *int { if o == nil { return nil } return o.Duration } -func (o *GetMetadataPart) GetFile() *string { +func (o *GetMetaDataByRatingKeyPart) GetFile() *string { if o == nil { return nil } return o.File } -func (o *GetMetadataPart) GetSize() *int { +func (o *GetMetaDataByRatingKeyPart) GetSize() *int { if o == nil { return nil } return o.Size } -func (o *GetMetadataPart) GetAudioProfile() *string { +func (o *GetMetaDataByRatingKeyPart) GetAudioProfile() *string { if o == nil { return nil } return o.AudioProfile } -func (o *GetMetadataPart) GetContainer() *string { +func (o *GetMetaDataByRatingKeyPart) GetContainer() *string { if o == nil { return nil } return o.Container } -func (o *GetMetadataPart) GetHas64bitOffsets() *bool { +func (o *GetMetaDataByRatingKeyPart) GetHas64bitOffsets() *bool { if o == nil { return nil } return o.Has64bitOffsets } -func (o *GetMetadataPart) GetOptimizedForStreaming() *bool { +func (o *GetMetaDataByRatingKeyPart) GetOptimizedForStreaming() *bool { if o == nil { return nil } return o.OptimizedForStreaming } -func (o *GetMetadataPart) GetVideoProfile() *string { +func (o *GetMetaDataByRatingKeyPart) GetVideoProfile() *string { if o == nil { return nil } return o.VideoProfile } -func (o *GetMetadataPart) GetStream() []Stream { +func (o *GetMetaDataByRatingKeyPart) GetStream() []Stream { if o == nil { return nil } return o.Stream } -type GetMetadataMedia struct { - ID *int `json:"id,omitempty"` - Duration *int `json:"duration,omitempty"` - Bitrate *int `json:"bitrate,omitempty"` - Width *int `json:"width,omitempty"` - Height *int `json:"height,omitempty"` - AspectRatio *float64 `json:"aspectRatio,omitempty"` - AudioChannels *int `json:"audioChannels,omitempty"` - AudioCodec *string `json:"audioCodec,omitempty"` - VideoCodec *string `json:"videoCodec,omitempty"` - VideoResolution *string `json:"videoResolution,omitempty"` - Container *string `json:"container,omitempty"` - VideoFrameRate *string `json:"videoFrameRate,omitempty"` - OptimizedForStreaming *int `json:"optimizedForStreaming,omitempty"` - AudioProfile *string `json:"audioProfile,omitempty"` - Has64bitOffsets *bool `json:"has64bitOffsets,omitempty"` - VideoProfile *string `json:"videoProfile,omitempty"` - Part []GetMetadataPart `json:"Part,omitempty"` +type GetMetaDataByRatingKeyMedia struct { + ID *int `json:"id,omitempty"` + Duration *int `json:"duration,omitempty"` + Bitrate *int `json:"bitrate,omitempty"` + Width *int `json:"width,omitempty"` + Height *int `json:"height,omitempty"` + AspectRatio *float64 `json:"aspectRatio,omitempty"` + AudioChannels *int `json:"audioChannels,omitempty"` + AudioCodec *string `json:"audioCodec,omitempty"` + VideoCodec *string `json:"videoCodec,omitempty"` + VideoResolution *string `json:"videoResolution,omitempty"` + Container *string `json:"container,omitempty"` + VideoFrameRate *string `json:"videoFrameRate,omitempty"` + OptimizedForStreaming *int `json:"optimizedForStreaming,omitempty"` + AudioProfile *string `json:"audioProfile,omitempty"` + Has64bitOffsets *bool `json:"has64bitOffsets,omitempty"` + VideoProfile *string `json:"videoProfile,omitempty"` + Part []GetMetaDataByRatingKeyPart `json:"Part,omitempty"` } -func (o *GetMetadataMedia) GetID() *int { +func (o *GetMetaDataByRatingKeyMedia) GetID() *int { if o == nil { return nil } return o.ID } -func (o *GetMetadataMedia) GetDuration() *int { +func (o *GetMetaDataByRatingKeyMedia) GetDuration() *int { if o == nil { return nil } return o.Duration } -func (o *GetMetadataMedia) GetBitrate() *int { +func (o *GetMetaDataByRatingKeyMedia) GetBitrate() *int { if o == nil { return nil } return o.Bitrate } -func (o *GetMetadataMedia) GetWidth() *int { +func (o *GetMetaDataByRatingKeyMedia) GetWidth() *int { if o == nil { return nil } return o.Width } -func (o *GetMetadataMedia) GetHeight() *int { +func (o *GetMetaDataByRatingKeyMedia) GetHeight() *int { if o == nil { return nil } return o.Height } -func (o *GetMetadataMedia) GetAspectRatio() *float64 { +func (o *GetMetaDataByRatingKeyMedia) GetAspectRatio() *float64 { if o == nil { return nil } return o.AspectRatio } -func (o *GetMetadataMedia) GetAudioChannels() *int { +func (o *GetMetaDataByRatingKeyMedia) GetAudioChannels() *int { if o == nil { return nil } return o.AudioChannels } -func (o *GetMetadataMedia) GetAudioCodec() *string { +func (o *GetMetaDataByRatingKeyMedia) GetAudioCodec() *string { if o == nil { return nil } return o.AudioCodec } -func (o *GetMetadataMedia) GetVideoCodec() *string { +func (o *GetMetaDataByRatingKeyMedia) GetVideoCodec() *string { if o == nil { return nil } return o.VideoCodec } -func (o *GetMetadataMedia) GetVideoResolution() *string { +func (o *GetMetaDataByRatingKeyMedia) GetVideoResolution() *string { if o == nil { return nil } return o.VideoResolution } -func (o *GetMetadataMedia) GetContainer() *string { +func (o *GetMetaDataByRatingKeyMedia) GetContainer() *string { if o == nil { return nil } return o.Container } -func (o *GetMetadataMedia) GetVideoFrameRate() *string { +func (o *GetMetaDataByRatingKeyMedia) GetVideoFrameRate() *string { if o == nil { return nil } return o.VideoFrameRate } -func (o *GetMetadataMedia) GetOptimizedForStreaming() *int { +func (o *GetMetaDataByRatingKeyMedia) GetOptimizedForStreaming() *int { if o == nil { return nil } return o.OptimizedForStreaming } -func (o *GetMetadataMedia) GetAudioProfile() *string { +func (o *GetMetaDataByRatingKeyMedia) GetAudioProfile() *string { if o == nil { return nil } return o.AudioProfile } -func (o *GetMetadataMedia) GetHas64bitOffsets() *bool { +func (o *GetMetaDataByRatingKeyMedia) GetHas64bitOffsets() *bool { if o == nil { return nil } return o.Has64bitOffsets } -func (o *GetMetadataMedia) GetVideoProfile() *string { +func (o *GetMetaDataByRatingKeyMedia) GetVideoProfile() *string { if o == nil { return nil } return o.VideoProfile } -func (o *GetMetadataMedia) GetPart() []GetMetadataPart { +func (o *GetMetaDataByRatingKeyMedia) GetPart() []GetMetaDataByRatingKeyPart { if o == nil { return nil } return o.Part } -type GetMetadataGenre struct { +type GetMetaDataByRatingKeyGenre struct { ID *int `json:"id,omitempty"` Filter *string `json:"filter,omitempty"` Tag *string `json:"tag,omitempty"` } -func (o *GetMetadataGenre) GetID() *int { +func (o *GetMetaDataByRatingKeyGenre) GetID() *int { if o == nil { return nil } return o.ID } -func (o *GetMetadataGenre) GetFilter() *string { +func (o *GetMetaDataByRatingKeyGenre) GetFilter() *string { if o == nil { return nil } return o.Filter } -func (o *GetMetadataGenre) GetTag() *string { +func (o *GetMetaDataByRatingKeyGenre) GetTag() *string { if o == nil { return nil } return o.Tag } -type GetMetadataCountry struct { +type GetMetaDataByRatingKeyCountry struct { ID *int `json:"id,omitempty"` Filter *string `json:"filter,omitempty"` Tag *string `json:"tag,omitempty"` } -func (o *GetMetadataCountry) GetID() *int { +func (o *GetMetaDataByRatingKeyCountry) GetID() *int { if o == nil { return nil } return o.ID } -func (o *GetMetadataCountry) GetFilter() *string { +func (o *GetMetaDataByRatingKeyCountry) GetFilter() *string { if o == nil { return nil } return o.Filter } -func (o *GetMetadataCountry) GetTag() *string { +func (o *GetMetaDataByRatingKeyCountry) GetTag() *string { if o == nil { return nil } @@ -601,7 +601,7 @@ func (o *Ratings) GetType() *string { return o.Type } -type GetMetadataDirector struct { +type GetMetaDataByRatingKeyDirector struct { ID *int `json:"id,omitempty"` Filter *string `json:"filter,omitempty"` Tag *string `json:"tag,omitempty"` @@ -609,42 +609,42 @@ type GetMetadataDirector struct { Thumb *string `json:"thumb,omitempty"` } -func (o *GetMetadataDirector) GetID() *int { +func (o *GetMetaDataByRatingKeyDirector) GetID() *int { if o == nil { return nil } return o.ID } -func (o *GetMetadataDirector) GetFilter() *string { +func (o *GetMetaDataByRatingKeyDirector) GetFilter() *string { if o == nil { return nil } return o.Filter } -func (o *GetMetadataDirector) GetTag() *string { +func (o *GetMetaDataByRatingKeyDirector) GetTag() *string { if o == nil { return nil } return o.Tag } -func (o *GetMetadataDirector) GetTagKey() *string { +func (o *GetMetaDataByRatingKeyDirector) GetTagKey() *string { if o == nil { return nil } return o.TagKey } -func (o *GetMetadataDirector) GetThumb() *string { +func (o *GetMetaDataByRatingKeyDirector) GetThumb() *string { if o == nil { return nil } return o.Thumb } -type GetMetadataWriter struct { +type GetMetaDataByRatingKeyWriter struct { ID *int `json:"id,omitempty"` Filter *string `json:"filter,omitempty"` Tag *string `json:"tag,omitempty"` @@ -652,42 +652,42 @@ type GetMetadataWriter struct { Thumb *string `json:"thumb,omitempty"` } -func (o *GetMetadataWriter) GetID() *int { +func (o *GetMetaDataByRatingKeyWriter) GetID() *int { if o == nil { return nil } return o.ID } -func (o *GetMetadataWriter) GetFilter() *string { +func (o *GetMetaDataByRatingKeyWriter) GetFilter() *string { if o == nil { return nil } return o.Filter } -func (o *GetMetadataWriter) GetTag() *string { +func (o *GetMetaDataByRatingKeyWriter) GetTag() *string { if o == nil { return nil } return o.Tag } -func (o *GetMetadataWriter) GetTagKey() *string { +func (o *GetMetaDataByRatingKeyWriter) GetTagKey() *string { if o == nil { return nil } return o.TagKey } -func (o *GetMetadataWriter) GetThumb() *string { +func (o *GetMetaDataByRatingKeyWriter) GetThumb() *string { if o == nil { return nil } return o.Thumb } -type GetMetadataRole struct { +type GetMetaDataByRatingKeyRole struct { ID *int `json:"id,omitempty"` Filter *string `json:"filter,omitempty"` Tag *string `json:"tag,omitempty"` @@ -696,42 +696,42 @@ type GetMetadataRole struct { Thumb *string `json:"thumb,omitempty"` } -func (o *GetMetadataRole) GetID() *int { +func (o *GetMetaDataByRatingKeyRole) GetID() *int { if o == nil { return nil } return o.ID } -func (o *GetMetadataRole) GetFilter() *string { +func (o *GetMetaDataByRatingKeyRole) GetFilter() *string { if o == nil { return nil } return o.Filter } -func (o *GetMetadataRole) GetTag() *string { +func (o *GetMetaDataByRatingKeyRole) GetTag() *string { if o == nil { return nil } return o.Tag } -func (o *GetMetadataRole) GetTagKey() *string { +func (o *GetMetaDataByRatingKeyRole) GetTagKey() *string { if o == nil { return nil } return o.TagKey } -func (o *GetMetadataRole) GetRole() *string { +func (o *GetMetaDataByRatingKeyRole) GetRole() *string { if o == nil { return nil } return o.Role } -func (o *GetMetadataRole) GetThumb() *string { +func (o *GetMetaDataByRatingKeyRole) GetThumb() *string { if o == nil { return nil } @@ -781,372 +781,372 @@ func (o *Producer) GetThumb() *string { return o.Thumb } -type GetMetadataMetadata 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"` - ContentRating *string `json:"contentRating,omitempty"` - Summary *string `json:"summary,omitempty"` - Rating *float64 `json:"rating,omitempty"` - AudienceRating *float64 `json:"audienceRating,omitempty"` - Year *int `json:"year,omitempty"` - Tagline *string `json:"tagline,omitempty"` - Thumb *string `json:"thumb,omitempty"` - Art *string `json:"art,omitempty"` - Duration *int `json:"duration,omitempty"` - OriginallyAvailableAt *types.Date `json:"originallyAvailableAt,omitempty"` - AddedAt *int `json:"addedAt,omitempty"` - UpdatedAt *int `json:"updatedAt,omitempty"` - AudienceRatingImage *string `json:"audienceRatingImage,omitempty"` - HasPremiumPrimaryExtra *string `json:"hasPremiumPrimaryExtra,omitempty"` - RatingImage *string `json:"ratingImage,omitempty"` - Media []GetMetadataMedia `json:"Media,omitempty"` - Genre []GetMetadataGenre `json:"Genre,omitempty"` - Country []GetMetadataCountry `json:"Country,omitempty"` - Guids []Guids `json:"Guid,omitempty"` - Ratings []Ratings `json:"Rating,omitempty"` - Director []GetMetadataDirector `json:"Director,omitempty"` - Writer []GetMetadataWriter `json:"Writer,omitempty"` - Role []GetMetadataRole `json:"Role,omitempty"` - Producer []Producer `json:"Producer,omitempty"` +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"` + ContentRating *string `json:"contentRating,omitempty"` + Summary *string `json:"summary,omitempty"` + Rating *float64 `json:"rating,omitempty"` + AudienceRating *float64 `json:"audienceRating,omitempty"` + Year *int `json:"year,omitempty"` + Tagline *string `json:"tagline,omitempty"` + Thumb *string `json:"thumb,omitempty"` + Art *string `json:"art,omitempty"` + Duration *int `json:"duration,omitempty"` + OriginallyAvailableAt *types.Date `json:"originallyAvailableAt,omitempty"` + AddedAt *int `json:"addedAt,omitempty"` + UpdatedAt *int `json:"updatedAt,omitempty"` + AudienceRatingImage *string `json:"audienceRatingImage,omitempty"` + HasPremiumPrimaryExtra *string `json:"hasPremiumPrimaryExtra,omitempty"` + RatingImage *string `json:"ratingImage,omitempty"` + Media []GetMetaDataByRatingKeyMedia `json:"Media,omitempty"` + Genre []GetMetaDataByRatingKeyGenre `json:"Genre,omitempty"` + Country []GetMetaDataByRatingKeyCountry `json:"Country,omitempty"` + Guids []Guids `json:"Guid,omitempty"` + Ratings []Ratings `json:"Rating,omitempty"` + Director []GetMetaDataByRatingKeyDirector `json:"Director,omitempty"` + Writer []GetMetaDataByRatingKeyWriter `json:"Writer,omitempty"` + Role []GetMetaDataByRatingKeyRole `json:"Role,omitempty"` + Producer []Producer `json:"Producer,omitempty"` } -func (g GetMetadataMetadata) MarshalJSON() ([]byte, error) { +func (g GetMetaDataByRatingKeyMetadata) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(g, "", false) } -func (g *GetMetadataMetadata) UnmarshalJSON(data []byte) error { +func (g *GetMetaDataByRatingKeyMetadata) UnmarshalJSON(data []byte) error { if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { return err } return nil } -func (o *GetMetadataMetadata) GetRatingKey() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetRatingKey() *string { if o == nil { return nil } return o.RatingKey } -func (o *GetMetadataMetadata) GetKey() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetKey() *string { if o == nil { return nil } return o.Key } -func (o *GetMetadataMetadata) GetGUID() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetGUID() *string { if o == nil { return nil } return o.GUID } -func (o *GetMetadataMetadata) GetStudio() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetStudio() *string { if o == nil { return nil } return o.Studio } -func (o *GetMetadataMetadata) GetType() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetType() *string { if o == nil { return nil } return o.Type } -func (o *GetMetadataMetadata) GetTitle() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetTitle() *string { if o == nil { return nil } return o.Title } -func (o *GetMetadataMetadata) GetLibrarySectionTitle() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetLibrarySectionTitle() *string { if o == nil { return nil } return o.LibrarySectionTitle } -func (o *GetMetadataMetadata) GetLibrarySectionID() *int { +func (o *GetMetaDataByRatingKeyMetadata) GetLibrarySectionID() *int { if o == nil { return nil } return o.LibrarySectionID } -func (o *GetMetadataMetadata) GetLibrarySectionKey() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetLibrarySectionKey() *string { if o == nil { return nil } return o.LibrarySectionKey } -func (o *GetMetadataMetadata) GetContentRating() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetContentRating() *string { if o == nil { return nil } return o.ContentRating } -func (o *GetMetadataMetadata) GetSummary() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetSummary() *string { if o == nil { return nil } return o.Summary } -func (o *GetMetadataMetadata) GetRating() *float64 { +func (o *GetMetaDataByRatingKeyMetadata) GetRating() *float64 { if o == nil { return nil } return o.Rating } -func (o *GetMetadataMetadata) GetAudienceRating() *float64 { +func (o *GetMetaDataByRatingKeyMetadata) GetAudienceRating() *float64 { if o == nil { return nil } return o.AudienceRating } -func (o *GetMetadataMetadata) GetYear() *int { +func (o *GetMetaDataByRatingKeyMetadata) GetYear() *int { if o == nil { return nil } return o.Year } -func (o *GetMetadataMetadata) GetTagline() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetTagline() *string { if o == nil { return nil } return o.Tagline } -func (o *GetMetadataMetadata) GetThumb() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetThumb() *string { if o == nil { return nil } return o.Thumb } -func (o *GetMetadataMetadata) GetArt() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetArt() *string { if o == nil { return nil } return o.Art } -func (o *GetMetadataMetadata) GetDuration() *int { +func (o *GetMetaDataByRatingKeyMetadata) GetDuration() *int { if o == nil { return nil } return o.Duration } -func (o *GetMetadataMetadata) GetOriginallyAvailableAt() *types.Date { +func (o *GetMetaDataByRatingKeyMetadata) GetOriginallyAvailableAt() *types.Date { if o == nil { return nil } return o.OriginallyAvailableAt } -func (o *GetMetadataMetadata) GetAddedAt() *int { +func (o *GetMetaDataByRatingKeyMetadata) GetAddedAt() *int { if o == nil { return nil } return o.AddedAt } -func (o *GetMetadataMetadata) GetUpdatedAt() *int { +func (o *GetMetaDataByRatingKeyMetadata) GetUpdatedAt() *int { if o == nil { return nil } return o.UpdatedAt } -func (o *GetMetadataMetadata) GetAudienceRatingImage() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetAudienceRatingImage() *string { if o == nil { return nil } return o.AudienceRatingImage } -func (o *GetMetadataMetadata) GetHasPremiumPrimaryExtra() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetHasPremiumPrimaryExtra() *string { if o == nil { return nil } return o.HasPremiumPrimaryExtra } -func (o *GetMetadataMetadata) GetRatingImage() *string { +func (o *GetMetaDataByRatingKeyMetadata) GetRatingImage() *string { if o == nil { return nil } return o.RatingImage } -func (o *GetMetadataMetadata) GetMedia() []GetMetadataMedia { +func (o *GetMetaDataByRatingKeyMetadata) GetMedia() []GetMetaDataByRatingKeyMedia { if o == nil { return nil } return o.Media } -func (o *GetMetadataMetadata) GetGenre() []GetMetadataGenre { +func (o *GetMetaDataByRatingKeyMetadata) GetGenre() []GetMetaDataByRatingKeyGenre { if o == nil { return nil } return o.Genre } -func (o *GetMetadataMetadata) GetCountry() []GetMetadataCountry { +func (o *GetMetaDataByRatingKeyMetadata) GetCountry() []GetMetaDataByRatingKeyCountry { if o == nil { return nil } return o.Country } -func (o *GetMetadataMetadata) GetGuids() []Guids { +func (o *GetMetaDataByRatingKeyMetadata) GetGuids() []Guids { if o == nil { return nil } return o.Guids } -func (o *GetMetadataMetadata) GetRatings() []Ratings { +func (o *GetMetaDataByRatingKeyMetadata) GetRatings() []Ratings { if o == nil { return nil } return o.Ratings } -func (o *GetMetadataMetadata) GetDirector() []GetMetadataDirector { +func (o *GetMetaDataByRatingKeyMetadata) GetDirector() []GetMetaDataByRatingKeyDirector { if o == nil { return nil } return o.Director } -func (o *GetMetadataMetadata) GetWriter() []GetMetadataWriter { +func (o *GetMetaDataByRatingKeyMetadata) GetWriter() []GetMetaDataByRatingKeyWriter { if o == nil { return nil } return o.Writer } -func (o *GetMetadataMetadata) GetRole() []GetMetadataRole { +func (o *GetMetaDataByRatingKeyMetadata) GetRole() []GetMetaDataByRatingKeyRole { if o == nil { return nil } return o.Role } -func (o *GetMetadataMetadata) GetProducer() []Producer { +func (o *GetMetaDataByRatingKeyMetadata) GetProducer() []Producer { if o == nil { return nil } return o.Producer } -type GetMetadataMediaContainer struct { - Size *int `json:"size,omitempty"` - AllowSync *bool `json:"allowSync,omitempty"` - Identifier *string `json:"identifier,omitempty"` - LibrarySectionID *int `json:"librarySectionID,omitempty"` - LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"` - LibrarySectionUUID *string `json:"librarySectionUUID,omitempty"` - MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"` - MediaTagVersion *int `json:"mediaTagVersion,omitempty"` - Metadata []GetMetadataMetadata `json:"Metadata,omitempty"` +type GetMetaDataByRatingKeyMediaContainer struct { + Size *int `json:"size,omitempty"` + AllowSync *bool `json:"allowSync,omitempty"` + Identifier *string `json:"identifier,omitempty"` + LibrarySectionID *int `json:"librarySectionID,omitempty"` + LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"` + LibrarySectionUUID *string `json:"librarySectionUUID,omitempty"` + MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"` + MediaTagVersion *int `json:"mediaTagVersion,omitempty"` + Metadata []GetMetaDataByRatingKeyMetadata `json:"Metadata,omitempty"` } -func (o *GetMetadataMediaContainer) GetSize() *int { +func (o *GetMetaDataByRatingKeyMediaContainer) GetSize() *int { if o == nil { return nil } return o.Size } -func (o *GetMetadataMediaContainer) GetAllowSync() *bool { +func (o *GetMetaDataByRatingKeyMediaContainer) GetAllowSync() *bool { if o == nil { return nil } return o.AllowSync } -func (o *GetMetadataMediaContainer) GetIdentifier() *string { +func (o *GetMetaDataByRatingKeyMediaContainer) GetIdentifier() *string { if o == nil { return nil } return o.Identifier } -func (o *GetMetadataMediaContainer) GetLibrarySectionID() *int { +func (o *GetMetaDataByRatingKeyMediaContainer) GetLibrarySectionID() *int { if o == nil { return nil } return o.LibrarySectionID } -func (o *GetMetadataMediaContainer) GetLibrarySectionTitle() *string { +func (o *GetMetaDataByRatingKeyMediaContainer) GetLibrarySectionTitle() *string { if o == nil { return nil } return o.LibrarySectionTitle } -func (o *GetMetadataMediaContainer) GetLibrarySectionUUID() *string { +func (o *GetMetaDataByRatingKeyMediaContainer) GetLibrarySectionUUID() *string { if o == nil { return nil } return o.LibrarySectionUUID } -func (o *GetMetadataMediaContainer) GetMediaTagPrefix() *string { +func (o *GetMetaDataByRatingKeyMediaContainer) GetMediaTagPrefix() *string { if o == nil { return nil } return o.MediaTagPrefix } -func (o *GetMetadataMediaContainer) GetMediaTagVersion() *int { +func (o *GetMetaDataByRatingKeyMediaContainer) GetMediaTagVersion() *int { if o == nil { return nil } return o.MediaTagVersion } -func (o *GetMetadataMediaContainer) GetMetadata() []GetMetadataMetadata { +func (o *GetMetaDataByRatingKeyMediaContainer) GetMetadata() []GetMetaDataByRatingKeyMetadata { if o == nil { return nil } return o.Metadata } -// GetMetadataResponseBody - The metadata of the library item. -type GetMetadataResponseBody struct { - MediaContainer *GetMetadataMediaContainer `json:"MediaContainer,omitempty"` +// GetMetaDataByRatingKeyResponseBody - The metadata of the library item. +type GetMetaDataByRatingKeyResponseBody struct { + MediaContainer *GetMetaDataByRatingKeyMediaContainer `json:"MediaContainer,omitempty"` } -func (o *GetMetadataResponseBody) GetMediaContainer() *GetMetadataMediaContainer { +func (o *GetMetaDataByRatingKeyResponseBody) GetMediaContainer() *GetMetaDataByRatingKeyMediaContainer { if o == nil { return nil } return o.MediaContainer } -type GetMetadataResponse struct { +type GetMetaDataByRatingKeyResponse struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation @@ -1154,31 +1154,31 @@ type GetMetadataResponse struct { // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // The metadata of the library item. - Object *GetMetadataResponseBody + Object *GetMetaDataByRatingKeyResponseBody } -func (o *GetMetadataResponse) GetContentType() string { +func (o *GetMetaDataByRatingKeyResponse) GetContentType() string { if o == nil { return "" } return o.ContentType } -func (o *GetMetadataResponse) GetStatusCode() int { +func (o *GetMetaDataByRatingKeyResponse) GetStatusCode() int { if o == nil { return 0 } return o.StatusCode } -func (o *GetMetadataResponse) GetRawResponse() *http.Response { +func (o *GetMetaDataByRatingKeyResponse) GetRawResponse() *http.Response { if o == nil { return nil } return o.RawResponse } -func (o *GetMetadataResponse) GetObject() *GetMetadataResponseBody { +func (o *GetMetaDataByRatingKeyResponse) GetObject() *GetMetaDataByRatingKeyResponseBody { if o == nil { return nil } diff --git a/models/operations/getmetadatachildren.go b/models/operations/getmetadatachildren.go index d0a9824..632c0c9 100644 --- a/models/operations/getmetadatachildren.go +++ b/models/operations/getmetadatachildren.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getmyplexaccount.go b/models/operations/getmyplexaccount.go index 8d49298..095d131 100644 --- a/models/operations/getmyplexaccount.go +++ b/models/operations/getmyplexaccount.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getondeck.go b/models/operations/getondeck.go index adfe70f..72f0025 100644 --- a/models/operations/getondeck.go +++ b/models/operations/getondeck.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getpin.go b/models/operations/getpin.go index b9da881..a38d7f5 100644 --- a/models/operations/getpin.go +++ b/models/operations/getpin.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -9,7 +9,7 @@ import ( ) var GetPinServerList = []string{ - "https://plex.tv/api/v2", + "https://plex.tv/api/v2/", } type GetPinGlobals struct { @@ -17,7 +17,7 @@ type GetPinGlobals struct { // This is used to track the client application and its usage // (UUID, serial number, or other number unique per device) // - XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` + XPlexClientIdentifier *string `queryParam:"style=form,explode=true,name=X-Plex-Client-Identifier"` } func (o *GetPinGlobals) GetXPlexClientIdentifier() *string { @@ -37,10 +37,8 @@ type GetPinRequest struct { // This is used to track the client application and its usage // (UUID, serial number, or other number unique per device) // - XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` - // Product name of the application shown in the list of devices - // - XPlexProduct string `header:"style=simple,explode=false,name=X-Plex-Product"` + XPlexClientIdentifier *string `queryParam:"style=form,explode=true,name=X-Plex-Client-Identifier"` + XPlexProduct *string `queryParam:"style=form,explode=true,name=X-Plex-Product"` } func (g GetPinRequest) MarshalJSON() ([]byte, error) { @@ -68,206 +66,235 @@ func (o *GetPinRequest) GetXPlexClientIdentifier() *string { return o.XPlexClientIdentifier } -func (o *GetPinRequest) GetXPlexProduct() string { +func (o *GetPinRequest) GetXPlexProduct() *string { if o == nil { - return "" + return nil } return o.XPlexProduct } -type Location struct { - Code *string `json:"code,omitempty"` - EuropeanUnionMember *bool `json:"european_union_member,omitempty"` - ContinentCode *string `json:"continent_code,omitempty"` - Country *string `json:"country,omitempty"` - City *string `json:"city,omitempty"` - TimeZone *string `json:"time_zone,omitempty"` - PostalCode *string `json:"postal_code,omitempty"` - InPrivacyRestrictedCountry *bool `json:"in_privacy_restricted_country,omitempty"` - Subdivisions *string `json:"subdivisions,omitempty"` - Coordinates *string `json:"coordinates,omitempty"` +// GeoData - Geo location data +type GeoData struct { + // The ISO 3166-1 alpha-2 code of the country. + Code string `json:"code"` + // The continent code where the country is located. + ContinentCode string `json:"continent_code"` + // The official name of the country. + Country string `json:"country"` + // The name of the city. + City string `json:"city"` + // Indicates if the country is a member of the European Union. + EuropeanUnionMember *bool `default:"false" json:"european_union_member"` + // The time zone of the country. + TimeZone string `json:"time_zone"` + // The postal code of the location. + PostalCode int64 `json:"postal_code"` + // Indicates if the country has privacy restrictions. + InPrivacyRestrictedCountry *bool `default:"false" json:"in_privacy_restricted_country"` + // Indicates if the region has privacy restrictions. + InPrivacyRestrictedRegion *bool `default:"false" json:"in_privacy_restricted_region"` + // The name of the primary administrative subdivision. + Subdivisions string `json:"subdivisions"` + // The geographical coordinates (latitude, longitude) of the location. + Coordinates string `json:"coordinates"` } -func (o *Location) GetCode() *string { - if o == nil { - return nil - } - return o.Code -} - -func (o *Location) GetEuropeanUnionMember() *bool { - if o == nil { - return nil - } - return o.EuropeanUnionMember -} - -func (o *Location) GetContinentCode() *string { - if o == nil { - return nil - } - return o.ContinentCode -} - -func (o *Location) GetCountry() *string { - if o == nil { - return nil - } - return o.Country -} - -func (o *Location) GetCity() *string { - if o == nil { - return nil - } - return o.City -} - -func (o *Location) GetTimeZone() *string { - if o == nil { - return nil - } - return o.TimeZone -} - -func (o *Location) GetPostalCode() *string { - if o == nil { - return nil - } - return o.PostalCode -} - -func (o *Location) GetInPrivacyRestrictedCountry() *bool { - if o == nil { - return nil - } - return o.InPrivacyRestrictedCountry -} - -func (o *Location) GetSubdivisions() *string { - if o == nil { - return nil - } - return o.Subdivisions -} - -func (o *Location) GetCoordinates() *string { - if o == nil { - return nil - } - return o.Coordinates -} - -// GetPinResponseBody - The Pin -type GetPinResponseBody struct { - // PinID for use with authentication - ID *float64 `json:"id,omitempty"` - Code *string `json:"code,omitempty"` - Product *string `json:"product,omitempty"` - Trusted *bool `json:"trusted,omitempty"` - // a link to a QR code hosted on plex.tv - // The QR code redirects to the relevant `plex.tv/link` authentication page - // Which then prompts the user for the 4 Digit Link Pin - // - Qr *string `json:"qr,omitempty"` - ClientIdentifier *string `json:"clientIdentifier,omitempty"` - Location *Location `json:"location,omitempty"` - ExpiresIn *float64 `json:"expiresIn,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty"` - ExpiresAt *time.Time `json:"expiresAt,omitempty"` - AuthToken *string `json:"authToken,omitempty"` - NewRegistration *bool `json:"newRegistration,omitempty"` -} - -func (g GetPinResponseBody) MarshalJSON() ([]byte, error) { +func (g GeoData) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(g, "", false) } -func (g *GetPinResponseBody) UnmarshalJSON(data []byte) error { +func (g *GeoData) UnmarshalJSON(data []byte) error { if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { return err } return nil } -func (o *GetPinResponseBody) GetID() *float64 { +func (o *GeoData) GetCode() string { if o == nil { - return nil - } - return o.ID -} - -func (o *GetPinResponseBody) GetCode() *string { - if o == nil { - return nil + return "" } return o.Code } -func (o *GetPinResponseBody) GetProduct() *string { +func (o *GeoData) GetContinentCode() string { + if o == nil { + return "" + } + return o.ContinentCode +} + +func (o *GeoData) GetCountry() string { + if o == nil { + return "" + } + return o.Country +} + +func (o *GeoData) GetCity() string { + if o == nil { + return "" + } + return o.City +} + +func (o *GeoData) GetEuropeanUnionMember() *bool { if o == nil { return nil } + return o.EuropeanUnionMember +} + +func (o *GeoData) GetTimeZone() string { + if o == nil { + return "" + } + return o.TimeZone +} + +func (o *GeoData) GetPostalCode() int64 { + if o == nil { + return 0 + } + return o.PostalCode +} + +func (o *GeoData) GetInPrivacyRestrictedCountry() *bool { + if o == nil { + return nil + } + return o.InPrivacyRestrictedCountry +} + +func (o *GeoData) GetInPrivacyRestrictedRegion() *bool { + if o == nil { + return nil + } + return o.InPrivacyRestrictedRegion +} + +func (o *GeoData) GetSubdivisions() string { + if o == nil { + return "" + } + return o.Subdivisions +} + +func (o *GeoData) GetCoordinates() string { + if o == nil { + return "" + } + return o.Coordinates +} + +// GetPinAuthPinContainer - Requests a new pin id used in the authentication flow +type GetPinAuthPinContainer struct { + ID int64 `json:"id"` + Code string `json:"code"` + Product string `json:"product"` + Trusted *bool `default:"false" json:"trusted"` + Qr string `json:"qr"` + // The X-Client-Identifier used in the request + ClientIdentifier string `json:"clientIdentifier"` + // Geo location data + Location GeoData `json:"location"` + // The number of seconds this pin expires, by default 900 seconds + ExpiresIn *int64 `default:"900" json:"expiresIn"` + CreatedAt time.Time `json:"createdAt"` + ExpiresAt time.Time `json:"expiresAt"` + AuthToken any `json:"authToken,omitempty"` + NewRegistration any `json:"newRegistration,omitempty"` +} + +func (g GetPinAuthPinContainer) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetPinAuthPinContainer) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetPinAuthPinContainer) GetID() int64 { + if o == nil { + return 0 + } + return o.ID +} + +func (o *GetPinAuthPinContainer) GetCode() string { + if o == nil { + return "" + } + return o.Code +} + +func (o *GetPinAuthPinContainer) GetProduct() string { + if o == nil { + return "" + } return o.Product } -func (o *GetPinResponseBody) GetTrusted() *bool { +func (o *GetPinAuthPinContainer) GetTrusted() *bool { if o == nil { return nil } return o.Trusted } -func (o *GetPinResponseBody) GetQr() *string { +func (o *GetPinAuthPinContainer) GetQr() string { if o == nil { - return nil + return "" } return o.Qr } -func (o *GetPinResponseBody) GetClientIdentifier() *string { +func (o *GetPinAuthPinContainer) GetClientIdentifier() string { if o == nil { - return nil + return "" } return o.ClientIdentifier } -func (o *GetPinResponseBody) GetLocation() *Location { +func (o *GetPinAuthPinContainer) GetLocation() GeoData { if o == nil { - return nil + return GeoData{} } return o.Location } -func (o *GetPinResponseBody) GetExpiresIn() *float64 { +func (o *GetPinAuthPinContainer) GetExpiresIn() *int64 { if o == nil { return nil } return o.ExpiresIn } -func (o *GetPinResponseBody) GetCreatedAt() *time.Time { +func (o *GetPinAuthPinContainer) GetCreatedAt() time.Time { if o == nil { - return nil + return time.Time{} } return o.CreatedAt } -func (o *GetPinResponseBody) GetExpiresAt() *time.Time { +func (o *GetPinAuthPinContainer) GetExpiresAt() time.Time { if o == nil { - return nil + return time.Time{} } return o.ExpiresAt } -func (o *GetPinResponseBody) GetAuthToken() *string { +func (o *GetPinAuthPinContainer) GetAuthToken() any { if o == nil { return nil } return o.AuthToken } -func (o *GetPinResponseBody) GetNewRegistration() *bool { +func (o *GetPinAuthPinContainer) GetNewRegistration() any { if o == nil { return nil } @@ -281,8 +308,8 @@ type GetPinResponse struct { StatusCode int // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response - // The Pin - Object *GetPinResponseBody + // Requests a new pin id used in the authentication flow + AuthPinContainer *GetPinAuthPinContainer } func (o *GetPinResponse) GetContentType() string { @@ -306,9 +333,9 @@ func (o *GetPinResponse) GetRawResponse() *http.Response { return o.RawResponse } -func (o *GetPinResponse) GetObject() *GetPinResponseBody { +func (o *GetPinResponse) GetAuthPinContainer() *GetPinAuthPinContainer { if o == nil { return nil } - return o.Object + return o.AuthPinContainer } diff --git a/models/operations/getplaylist.go b/models/operations/getplaylist.go index b7f1e5d..6983f43 100644 --- a/models/operations/getplaylist.go +++ b/models/operations/getplaylist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getplaylistcontents.go b/models/operations/getplaylistcontents.go index c48b11a..e6221f9 100644 --- a/models/operations/getplaylistcontents.go +++ b/models/operations/getplaylistcontents.go @@ -1,18 +1,64 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations import ( + "encoding/json" + "fmt" "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/types" "net/http" ) +// GetPlaylistContentsQueryParamType - The type of media to retrieve. +// 1 = movie +// 2 = show +// 3 = season +// 4 = episode +// E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries +type GetPlaylistContentsQueryParamType int64 + +const ( + GetPlaylistContentsQueryParamTypeOne GetPlaylistContentsQueryParamType = 1 + GetPlaylistContentsQueryParamTypeTwo GetPlaylistContentsQueryParamType = 2 + GetPlaylistContentsQueryParamTypeThree GetPlaylistContentsQueryParamType = 3 + GetPlaylistContentsQueryParamTypeFour GetPlaylistContentsQueryParamType = 4 +) + +func (e GetPlaylistContentsQueryParamType) ToPointer() *GetPlaylistContentsQueryParamType { + return &e +} +func (e *GetPlaylistContentsQueryParamType) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 1: + fallthrough + case 2: + fallthrough + case 3: + fallthrough + case 4: + *e = GetPlaylistContentsQueryParamType(v) + return nil + default: + return fmt.Errorf("invalid value for GetPlaylistContentsQueryParamType: %v", v) + } +} + type GetPlaylistContentsRequest struct { // the ID of the playlist PlaylistID float64 `pathParam:"style=simple,explode=false,name=playlistID"` - // the metadata type of the item to return - Type float64 `queryParam:"style=form,explode=true,name=type"` + // The type of media to retrieve. + // 1 = movie + // 2 = show + // 3 = season + // 4 = episode + // E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries + // + Type GetPlaylistContentsQueryParamType `queryParam:"style=form,explode=true,name=type"` } func (o *GetPlaylistContentsRequest) GetPlaylistID() float64 { @@ -22,9 +68,9 @@ func (o *GetPlaylistContentsRequest) GetPlaylistID() float64 { return o.PlaylistID } -func (o *GetPlaylistContentsRequest) GetType() float64 { +func (o *GetPlaylistContentsRequest) GetType() GetPlaylistContentsQueryParamType { if o == nil { - return 0.0 + return GetPlaylistContentsQueryParamType(0) } return o.Type } diff --git a/models/operations/getplaylists.go b/models/operations/getplaylists.go index 00ca8e3..b39e82f 100644 --- a/models/operations/getplaylists.go +++ b/models/operations/getplaylists.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getrecentlyadded.go b/models/operations/getrecentlyadded.go index ec8d891..8bd777d 100644 --- a/models/operations/getrecentlyadded.go +++ b/models/operations/getrecentlyadded.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -8,6 +8,44 @@ import ( "time" ) +type GetRecentlyAddedRequest struct { + // The index of the first item to return. If not specified, the first item will be returned. + // If the number of items exceeds the limit, the response will be paginated. + // By default this is 0 + // + XPlexContainerStart *int `default:"0" queryParam:"style=form,explode=true,name=X-Plex-Container-Start"` + // The number of items to return. If not specified, all items will be returned. + // If the number of items exceeds the limit, the response will be paginated. + // By default this is 50 + // + XPlexContainerSize *int `default:"50" queryParam:"style=form,explode=true,name=X-Plex-Container-Size"` +} + +func (g GetRecentlyAddedRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetRecentlyAddedRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetRecentlyAddedRequest) GetXPlexContainerStart() *int { + if o == nil { + return nil + } + return o.XPlexContainerStart +} + +func (o *GetRecentlyAddedRequest) GetXPlexContainerSize() *int { + if o == nil { + return nil + } + return o.XPlexContainerSize +} + type Part struct { ID *float64 `json:"id,omitempty"` Key *string `json:"key,omitempty"` diff --git a/models/operations/getrefreshlibrarymetadata.go b/models/operations/getrefreshlibrarymetadata.go new file mode 100644 index 0000000..e71ac91 --- /dev/null +++ b/models/operations/getrefreshlibrarymetadata.go @@ -0,0 +1,89 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "net/http" +) + +// Force the refresh even if the library is already being refreshed. +type Force int64 + +const ( + ForceZero Force = 0 + ForceOne Force = 1 +) + +func (e Force) ToPointer() *Force { + return &e +} +func (e *Force) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 0: + fallthrough + case 1: + *e = Force(v) + return nil + default: + return fmt.Errorf("invalid value for Force: %v", v) + } +} + +type GetRefreshLibraryMetadataRequest struct { + // The unique key of the Plex library. + // Note: This is unique in the context of the Plex server. + // + SectionKey int `pathParam:"style=simple,explode=false,name=sectionKey"` + // Force the refresh even if the library is already being refreshed. + Force *Force `queryParam:"style=form,explode=true,name=force"` +} + +func (o *GetRefreshLibraryMetadataRequest) GetSectionKey() int { + if o == nil { + return 0 + } + return o.SectionKey +} + +func (o *GetRefreshLibraryMetadataRequest) GetForce() *Force { + if o == nil { + return nil + } + return o.Force +} + +type GetRefreshLibraryMetadataResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response +} + +func (o *GetRefreshLibraryMetadataResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetRefreshLibraryMetadataResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetRefreshLibraryMetadataResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} diff --git a/models/operations/getresizedphoto.go b/models/operations/getresizedphoto.go index ceeed39..9630e9e 100644 --- a/models/operations/getresizedphoto.go +++ b/models/operations/getresizedphoto.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getresourcesstatistics.go b/models/operations/getresourcesstatistics.go index 1643ba9..a756460 100644 --- a/models/operations/getresourcesstatistics.go +++ b/models/operations/getresourcesstatistics.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getsearchlibrary.go b/models/operations/getsearchlibrary.go new file mode 100644 index 0000000..f422dda --- /dev/null +++ b/models/operations/getsearchlibrary.go @@ -0,0 +1,397 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "net/http" +) + +// QueryParamType - The type of media to retrieve. +// 1 = movie +// 2 = show +// 3 = season +// 4 = episode +// E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries +type QueryParamType int64 + +const ( + QueryParamTypeOne QueryParamType = 1 + QueryParamTypeTwo QueryParamType = 2 + QueryParamTypeThree QueryParamType = 3 + QueryParamTypeFour QueryParamType = 4 +) + +func (e QueryParamType) ToPointer() *QueryParamType { + return &e +} +func (e *QueryParamType) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 1: + fallthrough + case 2: + fallthrough + case 3: + fallthrough + case 4: + *e = QueryParamType(v) + return nil + default: + return fmt.Errorf("invalid value for QueryParamType: %v", v) + } +} + +type GetSearchLibraryRequest struct { + // The unique key of the Plex library. + // Note: This is unique in the context of the Plex server. + // + SectionKey int `pathParam:"style=simple,explode=false,name=sectionKey"` + // The type of media to retrieve. + // 1 = movie + // 2 = show + // 3 = season + // 4 = episode + // E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries + // + Type QueryParamType `queryParam:"style=form,explode=true,name=type"` +} + +func (o *GetSearchLibraryRequest) GetSectionKey() int { + if o == nil { + return 0 + } + return o.SectionKey +} + +func (o *GetSearchLibraryRequest) GetType() QueryParamType { + if o == nil { + return QueryParamType(0) + } + return o.Type +} + +type GetSearchLibraryMetadata struct { + RatingKey *string `json:"ratingKey,omitempty"` + Key *string `json:"key,omitempty"` + ParentRatingKey *string `json:"parentRatingKey,omitempty"` + GUID *string `json:"guid,omitempty"` + ParentGUID *string `json:"parentGuid,omitempty"` + ParentStudio *string `json:"parentStudio,omitempty"` + Type *string `json:"type,omitempty"` + Title *string `json:"title,omitempty"` + ParentKey *string `json:"parentKey,omitempty"` + ParentTitle *string `json:"parentTitle,omitempty"` + Summary *string `json:"summary,omitempty"` + Index *int `json:"index,omitempty"` + ParentIndex *int `json:"parentIndex,omitempty"` + ParentYear *int `json:"parentYear,omitempty"` + Thumb *string `json:"thumb,omitempty"` + Art *string `json:"art,omitempty"` + ParentThumb *string `json:"parentThumb,omitempty"` + ParentTheme *string `json:"parentTheme,omitempty"` + AddedAt *int `json:"addedAt,omitempty"` + UpdatedAt *int `json:"updatedAt,omitempty"` +} + +func (o *GetSearchLibraryMetadata) GetRatingKey() *string { + if o == nil { + return nil + } + return o.RatingKey +} + +func (o *GetSearchLibraryMetadata) GetKey() *string { + if o == nil { + return nil + } + return o.Key +} + +func (o *GetSearchLibraryMetadata) GetParentRatingKey() *string { + if o == nil { + return nil + } + return o.ParentRatingKey +} + +func (o *GetSearchLibraryMetadata) GetGUID() *string { + if o == nil { + return nil + } + return o.GUID +} + +func (o *GetSearchLibraryMetadata) GetParentGUID() *string { + if o == nil { + return nil + } + return o.ParentGUID +} + +func (o *GetSearchLibraryMetadata) GetParentStudio() *string { + if o == nil { + return nil + } + return o.ParentStudio +} + +func (o *GetSearchLibraryMetadata) GetType() *string { + if o == nil { + return nil + } + return o.Type +} + +func (o *GetSearchLibraryMetadata) GetTitle() *string { + if o == nil { + return nil + } + return o.Title +} + +func (o *GetSearchLibraryMetadata) GetParentKey() *string { + if o == nil { + return nil + } + return o.ParentKey +} + +func (o *GetSearchLibraryMetadata) GetParentTitle() *string { + if o == nil { + return nil + } + return o.ParentTitle +} + +func (o *GetSearchLibraryMetadata) GetSummary() *string { + if o == nil { + return nil + } + return o.Summary +} + +func (o *GetSearchLibraryMetadata) GetIndex() *int { + if o == nil { + return nil + } + return o.Index +} + +func (o *GetSearchLibraryMetadata) GetParentIndex() *int { + if o == nil { + return nil + } + return o.ParentIndex +} + +func (o *GetSearchLibraryMetadata) GetParentYear() *int { + if o == nil { + return nil + } + return o.ParentYear +} + +func (o *GetSearchLibraryMetadata) GetThumb() *string { + if o == nil { + return nil + } + return o.Thumb +} + +func (o *GetSearchLibraryMetadata) GetArt() *string { + if o == nil { + return nil + } + return o.Art +} + +func (o *GetSearchLibraryMetadata) GetParentThumb() *string { + if o == nil { + return nil + } + return o.ParentThumb +} + +func (o *GetSearchLibraryMetadata) GetParentTheme() *string { + if o == nil { + return nil + } + return o.ParentTheme +} + +func (o *GetSearchLibraryMetadata) GetAddedAt() *int { + if o == nil { + return nil + } + return o.AddedAt +} + +func (o *GetSearchLibraryMetadata) GetUpdatedAt() *int { + if o == nil { + return nil + } + return o.UpdatedAt +} + +type GetSearchLibraryMediaContainer struct { + Size *int `json:"size,omitempty"` + AllowSync *bool `json:"allowSync,omitempty"` + Art *string `json:"art,omitempty"` + Identifier *string `json:"identifier,omitempty"` + MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"` + MediaTagVersion *int `json:"mediaTagVersion,omitempty"` + Nocache *bool `json:"nocache,omitempty"` + Thumb *string `json:"thumb,omitempty"` + Title1 *string `json:"title1,omitempty"` + Title2 *string `json:"title2,omitempty"` + ViewGroup *string `json:"viewGroup,omitempty"` + ViewMode *int `json:"viewMode,omitempty"` + Metadata []GetSearchLibraryMetadata `json:"Metadata,omitempty"` +} + +func (o *GetSearchLibraryMediaContainer) GetSize() *int { + if o == nil { + return nil + } + return o.Size +} + +func (o *GetSearchLibraryMediaContainer) GetAllowSync() *bool { + if o == nil { + return nil + } + return o.AllowSync +} + +func (o *GetSearchLibraryMediaContainer) GetArt() *string { + if o == nil { + return nil + } + return o.Art +} + +func (o *GetSearchLibraryMediaContainer) GetIdentifier() *string { + if o == nil { + return nil + } + return o.Identifier +} + +func (o *GetSearchLibraryMediaContainer) GetMediaTagPrefix() *string { + if o == nil { + return nil + } + return o.MediaTagPrefix +} + +func (o *GetSearchLibraryMediaContainer) GetMediaTagVersion() *int { + if o == nil { + return nil + } + return o.MediaTagVersion +} + +func (o *GetSearchLibraryMediaContainer) GetNocache() *bool { + if o == nil { + return nil + } + return o.Nocache +} + +func (o *GetSearchLibraryMediaContainer) GetThumb() *string { + if o == nil { + return nil + } + return o.Thumb +} + +func (o *GetSearchLibraryMediaContainer) GetTitle1() *string { + if o == nil { + return nil + } + return o.Title1 +} + +func (o *GetSearchLibraryMediaContainer) GetTitle2() *string { + if o == nil { + return nil + } + return o.Title2 +} + +func (o *GetSearchLibraryMediaContainer) GetViewGroup() *string { + if o == nil { + return nil + } + return o.ViewGroup +} + +func (o *GetSearchLibraryMediaContainer) GetViewMode() *int { + if o == nil { + return nil + } + return o.ViewMode +} + +func (o *GetSearchLibraryMediaContainer) GetMetadata() []GetSearchLibraryMetadata { + if o == nil { + return nil + } + return o.Metadata +} + +// GetSearchLibraryResponseBody - The contents of the library by section and type +type GetSearchLibraryResponseBody struct { + MediaContainer *GetSearchLibraryMediaContainer `json:"MediaContainer,omitempty"` +} + +func (o *GetSearchLibraryResponseBody) GetMediaContainer() *GetSearchLibraryMediaContainer { + if o == nil { + return nil + } + return o.MediaContainer +} + +type GetSearchLibraryResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // The contents of the library by section and type + Object *GetSearchLibraryResponseBody +} + +func (o *GetSearchLibraryResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetSearchLibraryResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetSearchLibraryResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetSearchLibraryResponse) GetObject() *GetSearchLibraryResponseBody { + if o == nil { + return nil + } + return o.Object +} diff --git a/models/operations/getsearchresults.go b/models/operations/getsearchresults.go index 7af3ca8..3ed2aa5 100644 --- a/models/operations/getsearchresults.go +++ b/models/operations/getsearchresults.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getserveractivities.go b/models/operations/getserveractivities.go index f6f1334..9682e61 100644 --- a/models/operations/getserveractivities.go +++ b/models/operations/getserveractivities.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getservercapabilities.go b/models/operations/getservercapabilities.go index 8b724c4..6a9a058 100644 --- a/models/operations/getservercapabilities.go +++ b/models/operations/getservercapabilities.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getserveridentity.go b/models/operations/getserveridentity.go index cb9475b..7842023 100644 --- a/models/operations/getserveridentity.go +++ b/models/operations/getserveridentity.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getserverlist.go b/models/operations/getserverlist.go index 4ca69b8..2268ffb 100644 --- a/models/operations/getserverlist.go +++ b/models/operations/getserverlist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getserverpreferences.go b/models/operations/getserverpreferences.go index 5a6f4e3..b8d00cf 100644 --- a/models/operations/getserverpreferences.go +++ b/models/operations/getserverpreferences.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getserverresources.go b/models/operations/getserverresources.go new file mode 100644 index 0000000..c41fbf3 --- /dev/null +++ b/models/operations/getserverresources.go @@ -0,0 +1,481 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/LukeHagar/plexgo/internal/utils" + "net/http" + "time" +) + +var GetServerResourcesServerList = []string{ + "https://plex.tv/api/v2/", +} + +type GetServerResourcesGlobals struct { + // The unique identifier for the client application + // This is used to track the client application and its usage + // (UUID, serial number, or other number unique per device) + // + XPlexClientIdentifier *string `queryParam:"style=form,explode=true,name=X-Plex-Client-Identifier"` +} + +func (o *GetServerResourcesGlobals) GetXPlexClientIdentifier() *string { + if o == nil { + return nil + } + return o.XPlexClientIdentifier +} + +// IncludeHTTPS - Include Https entries in the results +type IncludeHTTPS int + +const ( + IncludeHTTPSZero IncludeHTTPS = 0 + IncludeHTTPSOne IncludeHTTPS = 1 +) + +func (e IncludeHTTPS) ToPointer() *IncludeHTTPS { + return &e +} +func (e *IncludeHTTPS) UnmarshalJSON(data []byte) error { + var v int + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 0: + fallthrough + case 1: + *e = IncludeHTTPS(v) + return nil + default: + return fmt.Errorf("invalid value for IncludeHTTPS: %v", v) + } +} + +// IncludeRelay - Include Relay addresses in the results +// E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400 +type IncludeRelay int + +const ( + IncludeRelayZero IncludeRelay = 0 + IncludeRelayOne IncludeRelay = 1 +) + +func (e IncludeRelay) ToPointer() *IncludeRelay { + return &e +} +func (e *IncludeRelay) UnmarshalJSON(data []byte) error { + var v int + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 0: + fallthrough + case 1: + *e = IncludeRelay(v) + return nil + default: + return fmt.Errorf("invalid value for IncludeRelay: %v", v) + } +} + +// IncludeIPv6 - Include IPv6 entries in the results +type IncludeIPv6 int + +const ( + IncludeIPv6Zero IncludeIPv6 = 0 + IncludeIPv6One IncludeIPv6 = 1 +) + +func (e IncludeIPv6) ToPointer() *IncludeIPv6 { + return &e +} +func (e *IncludeIPv6) UnmarshalJSON(data []byte) error { + var v int + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 0: + fallthrough + case 1: + *e = IncludeIPv6(v) + return nil + default: + return fmt.Errorf("invalid value for IncludeIPv6: %v", v) + } +} + +type GetServerResourcesRequest struct { + // The unique identifier for the client application + // This is used to track the client application and its usage + // (UUID, serial number, or other number unique per device) + // + XPlexClientIdentifier *string `queryParam:"style=form,explode=true,name=X-Plex-Client-Identifier"` + // Plex Authentication Token + XPlexToken string `queryParam:"style=form,explode=true,name=X-Plex-Token"` + // Include Https entries in the results + IncludeHTTPS *IncludeHTTPS `default:"0" queryParam:"style=form,explode=true,name=includeHttps"` + // Include Relay addresses in the results + // E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400 + // + IncludeRelay *IncludeRelay `default:"0" queryParam:"style=form,explode=true,name=includeRelay"` + // Include IPv6 entries in the results + IncludeIPv6 *IncludeIPv6 `default:"0" queryParam:"style=form,explode=true,name=includeIPv6"` +} + +func (g GetServerResourcesRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetServerResourcesRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetServerResourcesRequest) GetXPlexClientIdentifier() *string { + if o == nil { + return nil + } + return o.XPlexClientIdentifier +} + +func (o *GetServerResourcesRequest) GetXPlexToken() string { + if o == nil { + return "" + } + return o.XPlexToken +} + +func (o *GetServerResourcesRequest) GetIncludeHTTPS() *IncludeHTTPS { + if o == nil { + return nil + } + return o.IncludeHTTPS +} + +func (o *GetServerResourcesRequest) GetIncludeRelay() *IncludeRelay { + if o == nil { + return nil + } + return o.IncludeRelay +} + +func (o *GetServerResourcesRequest) GetIncludeIPv6() *IncludeIPv6 { + if o == nil { + return nil + } + return o.IncludeIPv6 +} + +type Connections struct { + Protocol string `json:"protocol"` + Address string `json:"address"` + Port float64 `json:"port"` + URI string `json:"uri"` + Local bool `json:"local"` + Relay bool `json:"relay"` + IPv6 bool `json:"IPv6"` +} + +func (o *Connections) GetProtocol() string { + if o == nil { + return "" + } + return o.Protocol +} + +func (o *Connections) GetAddress() string { + if o == nil { + return "" + } + return o.Address +} + +func (o *Connections) GetPort() float64 { + if o == nil { + return 0.0 + } + return o.Port +} + +func (o *Connections) GetURI() string { + if o == nil { + return "" + } + return o.URI +} + +func (o *Connections) GetLocal() bool { + if o == nil { + return false + } + return o.Local +} + +func (o *Connections) GetRelay() bool { + if o == nil { + return false + } + return o.Relay +} + +func (o *Connections) GetIPv6() bool { + if o == nil { + return false + } + return o.IPv6 +} + +type PlexDevice struct { + Name string `json:"name"` + Product string `json:"product"` + ProductVersion string `json:"productVersion"` + Platform *string `json:"platform"` + PlatformVersion *string `json:"platformVersion"` + Device *string `json:"device"` + ClientIdentifier string `json:"clientIdentifier"` + CreatedAt time.Time `json:"createdAt"` + LastSeenAt time.Time `json:"lastSeenAt"` + Provides string `json:"provides"` + // ownerId is null when the device is owned by the token used to send the request + OwnerID *int64 `json:"ownerId"` + SourceTitle *string `json:"sourceTitle"` + PublicAddress string `json:"publicAddress"` + AccessToken string `json:"accessToken"` + Owned bool `json:"owned"` + Home bool `json:"home"` + Synced bool `json:"synced"` + Relay bool `json:"relay"` + Presence bool `json:"presence"` + HTTPSRequired bool `json:"httpsRequired"` + PublicAddressMatches bool `json:"publicAddressMatches"` + DNSRebindingProtection bool `json:"dnsRebindingProtection"` + NatLoopbackSupported bool `json:"natLoopbackSupported"` + Connections []Connections `json:"connections"` +} + +func (p PlexDevice) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PlexDevice) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil +} + +func (o *PlexDevice) GetName() string { + if o == nil { + return "" + } + return o.Name +} + +func (o *PlexDevice) GetProduct() string { + if o == nil { + return "" + } + return o.Product +} + +func (o *PlexDevice) GetProductVersion() string { + if o == nil { + return "" + } + return o.ProductVersion +} + +func (o *PlexDevice) GetPlatform() *string { + if o == nil { + return nil + } + return o.Platform +} + +func (o *PlexDevice) GetPlatformVersion() *string { + if o == nil { + return nil + } + return o.PlatformVersion +} + +func (o *PlexDevice) GetDevice() *string { + if o == nil { + return nil + } + return o.Device +} + +func (o *PlexDevice) GetClientIdentifier() string { + if o == nil { + return "" + } + return o.ClientIdentifier +} + +func (o *PlexDevice) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *PlexDevice) GetLastSeenAt() time.Time { + if o == nil { + return time.Time{} + } + return o.LastSeenAt +} + +func (o *PlexDevice) GetProvides() string { + if o == nil { + return "" + } + return o.Provides +} + +func (o *PlexDevice) GetOwnerID() *int64 { + if o == nil { + return nil + } + return o.OwnerID +} + +func (o *PlexDevice) GetSourceTitle() *string { + if o == nil { + return nil + } + return o.SourceTitle +} + +func (o *PlexDevice) GetPublicAddress() string { + if o == nil { + return "" + } + return o.PublicAddress +} + +func (o *PlexDevice) GetAccessToken() string { + if o == nil { + return "" + } + return o.AccessToken +} + +func (o *PlexDevice) GetOwned() bool { + if o == nil { + return false + } + return o.Owned +} + +func (o *PlexDevice) GetHome() bool { + if o == nil { + return false + } + return o.Home +} + +func (o *PlexDevice) GetSynced() bool { + if o == nil { + return false + } + return o.Synced +} + +func (o *PlexDevice) GetRelay() bool { + if o == nil { + return false + } + return o.Relay +} + +func (o *PlexDevice) GetPresence() bool { + if o == nil { + return false + } + return o.Presence +} + +func (o *PlexDevice) GetHTTPSRequired() bool { + if o == nil { + return false + } + return o.HTTPSRequired +} + +func (o *PlexDevice) GetPublicAddressMatches() bool { + if o == nil { + return false + } + return o.PublicAddressMatches +} + +func (o *PlexDevice) GetDNSRebindingProtection() bool { + if o == nil { + return false + } + return o.DNSRebindingProtection +} + +func (o *PlexDevice) GetNatLoopbackSupported() bool { + if o == nil { + return false + } + return o.NatLoopbackSupported +} + +func (o *PlexDevice) GetConnections() []Connections { + if o == nil { + return []Connections{} + } + return o.Connections +} + +type GetServerResourcesResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // List of Plex Devices. This includes Plex hosted servers and clients + PlexDevices []PlexDevice +} + +func (o *GetServerResourcesResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetServerResourcesResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetServerResourcesResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetServerResourcesResponse) GetPlexDevices() []PlexDevice { + if o == nil { + return nil + } + return o.PlexDevices +} diff --git a/models/operations/getsessionhistory.go b/models/operations/getsessionhistory.go index 824cfd2..cee8a5c 100644 --- a/models/operations/getsessionhistory.go +++ b/models/operations/getsessionhistory.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -8,9 +8,9 @@ import ( "net/http" ) -// Filter - Filters content by field and direction/equality +// QueryParamFilter - Filters content by field and direction/equality // (Unknown if viewedAt is the only supported column) -type Filter struct { +type QueryParamFilter struct { } type GetSessionHistoryRequest struct { @@ -23,7 +23,7 @@ type GetSessionHistoryRequest struct { // Filters content by field and direction/equality // (Unknown if viewedAt is the only supported column) // - Filter *Filter `queryParam:"style=form,explode=true,name=filter"` + Filter *QueryParamFilter `queryParam:"style=form,explode=true,name=filter"` // Filters the results based on the id of a valid library section // LibrarySectionID *int64 `queryParam:"style=form,explode=true,name=librarySectionID"` @@ -43,7 +43,7 @@ func (o *GetSessionHistoryRequest) GetAccountID() *int64 { return o.AccountID } -func (o *GetSessionHistoryRequest) GetFilter() *Filter { +func (o *GetSessionHistoryRequest) GetFilter() *QueryParamFilter { if o == nil { return nil } diff --git a/models/operations/getsessions.go b/models/operations/getsessions.go index 9365ab7..f719dd4 100644 --- a/models/operations/getsessions.go +++ b/models/operations/getsessions.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getsourceconnectioninformation.go b/models/operations/getsourceconnectioninformation.go index d84897f..2e7a3ae 100644 --- a/models/operations/getsourceconnectioninformation.go +++ b/models/operations/getsourceconnectioninformation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getstatistics.go b/models/operations/getstatistics.go index 2f70864..01c6e28 100644 --- a/models/operations/getstatistics.go +++ b/models/operations/getstatistics.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getthumbimage.go b/models/operations/getthumbimage.go new file mode 100644 index 0000000..702c508 --- /dev/null +++ b/models/operations/getthumbimage.go @@ -0,0 +1,109 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "io" + "net/http" +) + +type GetThumbImageRequest struct { + // the id of the library item to return the children of. + RatingKey int64 `pathParam:"style=simple,explode=false,name=ratingKey"` + Width int64 `queryParam:"style=form,explode=true,name=width"` + Height int64 `queryParam:"style=form,explode=true,name=height"` + MinSize int64 `queryParam:"style=form,explode=true,name=minSize"` + Upscale int64 `queryParam:"style=form,explode=true,name=upscale"` + // Plex Authentication Token + XPlexToken string `queryParam:"style=form,explode=true,name=X-Plex-Token"` +} + +func (o *GetThumbImageRequest) GetRatingKey() int64 { + if o == nil { + return 0 + } + return o.RatingKey +} + +func (o *GetThumbImageRequest) GetWidth() int64 { + if o == nil { + return 0 + } + return o.Width +} + +func (o *GetThumbImageRequest) GetHeight() int64 { + if o == nil { + return 0 + } + return o.Height +} + +func (o *GetThumbImageRequest) GetMinSize() int64 { + if o == nil { + return 0 + } + return o.MinSize +} + +func (o *GetThumbImageRequest) GetUpscale() int64 { + if o == nil { + return 0 + } + return o.Upscale +} + +func (o *GetThumbImageRequest) GetXPlexToken() string { + if o == nil { + return "" + } + return o.XPlexToken +} + +type GetThumbImageResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Successful response returning an image + // The Close method must be called on this field, even if it is not used, to prevent resource leaks. + ResponseStream io.ReadCloser + Headers map[string][]string +} + +func (o *GetThumbImageResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetThumbImageResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetThumbImageResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetThumbImageResponse) GetResponseStream() io.ReadCloser { + if o == nil { + return nil + } + return o.ResponseStream +} + +func (o *GetThumbImageResponse) GetHeaders() map[string][]string { + if o == nil { + return map[string][]string{} + } + return o.Headers +} diff --git a/models/operations/gettimeline.go b/models/operations/gettimeline.go index bd3681a..ecc2305 100644 --- a/models/operations/gettimeline.go +++ b/models/operations/gettimeline.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/gettoken.go b/models/operations/gettoken.go deleted file mode 100644 index 599a699..0000000 --- a/models/operations/gettoken.go +++ /dev/null @@ -1,290 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package operations - -import ( - "github.com/LukeHagar/plexgo/internal/utils" - "net/http" - "time" -) - -var GetTokenServerList = []string{ - "https://plex.tv/api/v2", -} - -type GetTokenGlobals struct { - // The unique identifier for the client application - // This is used to track the client application and its usage - // (UUID, serial number, or other number unique per device) - // - XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` -} - -func (o *GetTokenGlobals) GetXPlexClientIdentifier() *string { - if o == nil { - return nil - } - return o.XPlexClientIdentifier -} - -type GetTokenRequest struct { - // The PinID to retrieve an access token for - PinID string `pathParam:"style=simple,explode=false,name=pinID"` - // The unique identifier for the client application - // This is used to track the client application and its usage - // (UUID, serial number, or other number unique per device) - // - XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` -} - -func (o *GetTokenRequest) GetPinID() string { - if o == nil { - return "" - } - return o.PinID -} - -func (o *GetTokenRequest) GetXPlexClientIdentifier() *string { - if o == nil { - return nil - } - return o.XPlexClientIdentifier -} - -type GetTokenLocation struct { - Code *string `json:"code,omitempty"` - EuropeanUnionMember *bool `json:"european_union_member,omitempty"` - ContinentCode *string `json:"continent_code,omitempty"` - Country *string `json:"country,omitempty"` - City *string `json:"city,omitempty"` - TimeZone *string `json:"time_zone,omitempty"` - PostalCode *string `json:"postal_code,omitempty"` - InPrivacyRestrictedCountry *bool `json:"in_privacy_restricted_country,omitempty"` - Subdivisions *string `json:"subdivisions,omitempty"` - Coordinates *string `json:"coordinates,omitempty"` -} - -func (o *GetTokenLocation) GetCode() *string { - if o == nil { - return nil - } - return o.Code -} - -func (o *GetTokenLocation) GetEuropeanUnionMember() *bool { - if o == nil { - return nil - } - return o.EuropeanUnionMember -} - -func (o *GetTokenLocation) GetContinentCode() *string { - if o == nil { - return nil - } - return o.ContinentCode -} - -func (o *GetTokenLocation) GetCountry() *string { - if o == nil { - return nil - } - return o.Country -} - -func (o *GetTokenLocation) GetCity() *string { - if o == nil { - return nil - } - return o.City -} - -func (o *GetTokenLocation) GetTimeZone() *string { - if o == nil { - return nil - } - return o.TimeZone -} - -func (o *GetTokenLocation) GetPostalCode() *string { - if o == nil { - return nil - } - return o.PostalCode -} - -func (o *GetTokenLocation) GetInPrivacyRestrictedCountry() *bool { - if o == nil { - return nil - } - return o.InPrivacyRestrictedCountry -} - -func (o *GetTokenLocation) GetSubdivisions() *string { - if o == nil { - return nil - } - return o.Subdivisions -} - -func (o *GetTokenLocation) GetCoordinates() *string { - if o == nil { - return nil - } - return o.Coordinates -} - -// GetTokenResponseBody - Access Token -type GetTokenResponseBody struct { - // PinID for use with authentication - ID *float64 `json:"id,omitempty"` - Code *string `json:"code,omitempty"` - Product *string `json:"product,omitempty"` - Trusted *bool `json:"trusted,omitempty"` - // a link to a QR code hosted on plex.tv - // The QR code redirects to the relevant `plex.tv/link` authentication page - // Which then prompts the user for the 4 Digit Link Pin - // - Qr *string `json:"qr,omitempty"` - ClientIdentifier *string `json:"clientIdentifier,omitempty"` - Location *GetTokenLocation `json:"location,omitempty"` - ExpiresIn *float64 `json:"expiresIn,omitempty"` - CreatedAt *time.Time `json:"createdAt,omitempty"` - ExpiresAt *time.Time `json:"expiresAt,omitempty"` - AuthToken *string `json:"authToken,omitempty"` - NewRegistration *string `json:"newRegistration,omitempty"` -} - -func (g GetTokenResponseBody) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(g, "", false) -} - -func (g *GetTokenResponseBody) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { - return err - } - return nil -} - -func (o *GetTokenResponseBody) GetID() *float64 { - if o == nil { - return nil - } - return o.ID -} - -func (o *GetTokenResponseBody) GetCode() *string { - if o == nil { - return nil - } - return o.Code -} - -func (o *GetTokenResponseBody) GetProduct() *string { - if o == nil { - return nil - } - return o.Product -} - -func (o *GetTokenResponseBody) GetTrusted() *bool { - if o == nil { - return nil - } - return o.Trusted -} - -func (o *GetTokenResponseBody) GetQr() *string { - if o == nil { - return nil - } - return o.Qr -} - -func (o *GetTokenResponseBody) GetClientIdentifier() *string { - if o == nil { - return nil - } - return o.ClientIdentifier -} - -func (o *GetTokenResponseBody) GetLocation() *GetTokenLocation { - if o == nil { - return nil - } - return o.Location -} - -func (o *GetTokenResponseBody) GetExpiresIn() *float64 { - if o == nil { - return nil - } - return o.ExpiresIn -} - -func (o *GetTokenResponseBody) GetCreatedAt() *time.Time { - if o == nil { - return nil - } - return o.CreatedAt -} - -func (o *GetTokenResponseBody) GetExpiresAt() *time.Time { - if o == nil { - return nil - } - return o.ExpiresAt -} - -func (o *GetTokenResponseBody) GetAuthToken() *string { - if o == nil { - return nil - } - return o.AuthToken -} - -func (o *GetTokenResponseBody) GetNewRegistration() *string { - if o == nil { - return nil - } - return o.NewRegistration -} - -type GetTokenResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // Access Token - Object *GetTokenResponseBody -} - -func (o *GetTokenResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *GetTokenResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *GetTokenResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *GetTokenResponse) GetObject() *GetTokenResponseBody { - if o == nil { - return nil - } - return o.Object -} diff --git a/models/operations/gettokenbypinid.go b/models/operations/gettokenbypinid.go new file mode 100644 index 0000000..cba735c --- /dev/null +++ b/models/operations/gettokenbypinid.go @@ -0,0 +1,319 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/LukeHagar/plexgo/internal/utils" + "net/http" + "time" +) + +var GetTokenByPinIDServerList = []string{ + "https://plex.tv/api/v2/", +} + +type GetTokenByPinIDGlobals struct { + // The unique identifier for the client application + // This is used to track the client application and its usage + // (UUID, serial number, or other number unique per device) + // + XPlexClientIdentifier *string `queryParam:"style=form,explode=true,name=X-Plex-Client-Identifier"` +} + +func (o *GetTokenByPinIDGlobals) GetXPlexClientIdentifier() *string { + if o == nil { + return nil + } + return o.XPlexClientIdentifier +} + +type GetTokenByPinIDRequest struct { + // The unique identifier for the client application + // This is used to track the client application and its usage + // (UUID, serial number, or other number unique per device) + // + XPlexClientIdentifier *string `queryParam:"style=form,explode=true,name=X-Plex-Client-Identifier"` + // The PinID to retrieve an access token for + PinID int64 `pathParam:"style=simple,explode=false,name=pinID"` +} + +func (o *GetTokenByPinIDRequest) GetXPlexClientIdentifier() *string { + if o == nil { + return nil + } + return o.XPlexClientIdentifier +} + +func (o *GetTokenByPinIDRequest) GetPinID() int64 { + if o == nil { + return 0 + } + return o.PinID +} + +// GetTokenByPinIDGeoData - Geo location data +type GetTokenByPinIDGeoData struct { + // The ISO 3166-1 alpha-2 code of the country. + Code string `json:"code"` + // The continent code where the country is located. + ContinentCode string `json:"continent_code"` + // The official name of the country. + Country string `json:"country"` + // The name of the city. + City string `json:"city"` + // Indicates if the country is a member of the European Union. + EuropeanUnionMember *bool `default:"false" json:"european_union_member"` + // The time zone of the country. + TimeZone string `json:"time_zone"` + // The postal code of the location. + PostalCode int64 `json:"postal_code"` + // Indicates if the country has privacy restrictions. + InPrivacyRestrictedCountry *bool `default:"false" json:"in_privacy_restricted_country"` + // Indicates if the region has privacy restrictions. + InPrivacyRestrictedRegion *bool `default:"false" json:"in_privacy_restricted_region"` + // The name of the primary administrative subdivision. + Subdivisions string `json:"subdivisions"` + // The geographical coordinates (latitude, longitude) of the location. + Coordinates string `json:"coordinates"` +} + +func (g GetTokenByPinIDGeoData) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetTokenByPinIDGeoData) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetTokenByPinIDGeoData) GetCode() string { + if o == nil { + return "" + } + return o.Code +} + +func (o *GetTokenByPinIDGeoData) GetContinentCode() string { + if o == nil { + return "" + } + return o.ContinentCode +} + +func (o *GetTokenByPinIDGeoData) GetCountry() string { + if o == nil { + return "" + } + return o.Country +} + +func (o *GetTokenByPinIDGeoData) GetCity() string { + if o == nil { + return "" + } + return o.City +} + +func (o *GetTokenByPinIDGeoData) GetEuropeanUnionMember() *bool { + if o == nil { + return nil + } + return o.EuropeanUnionMember +} + +func (o *GetTokenByPinIDGeoData) GetTimeZone() string { + if o == nil { + return "" + } + return o.TimeZone +} + +func (o *GetTokenByPinIDGeoData) GetPostalCode() int64 { + if o == nil { + return 0 + } + return o.PostalCode +} + +func (o *GetTokenByPinIDGeoData) GetInPrivacyRestrictedCountry() *bool { + if o == nil { + return nil + } + return o.InPrivacyRestrictedCountry +} + +func (o *GetTokenByPinIDGeoData) GetInPrivacyRestrictedRegion() *bool { + if o == nil { + return nil + } + return o.InPrivacyRestrictedRegion +} + +func (o *GetTokenByPinIDGeoData) GetSubdivisions() string { + if o == nil { + return "" + } + return o.Subdivisions +} + +func (o *GetTokenByPinIDGeoData) GetCoordinates() string { + if o == nil { + return "" + } + return o.Coordinates +} + +// GetTokenByPinIDAuthPinContainer - The Pin with a non-null authToken when it has been verified by the user +type GetTokenByPinIDAuthPinContainer struct { + ID int64 `json:"id"` + Code string `json:"code"` + Product string `json:"product"` + Trusted *bool `default:"false" json:"trusted"` + Qr string `json:"qr"` + // The X-Client-Identifier used in the request + ClientIdentifier string `json:"clientIdentifier"` + // Geo location data + Location GetTokenByPinIDGeoData `json:"location"` + // The number of seconds this pin expires, by default 900 seconds + ExpiresIn *int64 `default:"900" json:"expiresIn"` + CreatedAt time.Time `json:"createdAt"` + ExpiresAt time.Time `json:"expiresAt"` + AuthToken any `json:"authToken,omitempty"` + NewRegistration any `json:"newRegistration,omitempty"` +} + +func (g GetTokenByPinIDAuthPinContainer) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetTokenByPinIDAuthPinContainer) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetTokenByPinIDAuthPinContainer) GetID() int64 { + if o == nil { + return 0 + } + return o.ID +} + +func (o *GetTokenByPinIDAuthPinContainer) GetCode() string { + if o == nil { + return "" + } + return o.Code +} + +func (o *GetTokenByPinIDAuthPinContainer) GetProduct() string { + if o == nil { + return "" + } + return o.Product +} + +func (o *GetTokenByPinIDAuthPinContainer) GetTrusted() *bool { + if o == nil { + return nil + } + return o.Trusted +} + +func (o *GetTokenByPinIDAuthPinContainer) GetQr() string { + if o == nil { + return "" + } + return o.Qr +} + +func (o *GetTokenByPinIDAuthPinContainer) GetClientIdentifier() string { + if o == nil { + return "" + } + return o.ClientIdentifier +} + +func (o *GetTokenByPinIDAuthPinContainer) GetLocation() GetTokenByPinIDGeoData { + if o == nil { + return GetTokenByPinIDGeoData{} + } + return o.Location +} + +func (o *GetTokenByPinIDAuthPinContainer) GetExpiresIn() *int64 { + if o == nil { + return nil + } + return o.ExpiresIn +} + +func (o *GetTokenByPinIDAuthPinContainer) GetCreatedAt() time.Time { + if o == nil { + return time.Time{} + } + return o.CreatedAt +} + +func (o *GetTokenByPinIDAuthPinContainer) GetExpiresAt() time.Time { + if o == nil { + return time.Time{} + } + return o.ExpiresAt +} + +func (o *GetTokenByPinIDAuthPinContainer) GetAuthToken() any { + if o == nil { + return nil + } + return o.AuthToken +} + +func (o *GetTokenByPinIDAuthPinContainer) GetNewRegistration() any { + if o == nil { + return nil + } + return o.NewRegistration +} + +type GetTokenByPinIDResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // The Pin with a non-null authToken when it has been verified by the user + AuthPinContainer *GetTokenByPinIDAuthPinContainer +} + +func (o *GetTokenByPinIDResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetTokenByPinIDResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetTokenByPinIDResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetTokenByPinIDResponse) GetAuthPinContainer() *GetTokenByPinIDAuthPinContainer { + if o == nil { + return nil + } + return o.AuthPinContainer +} diff --git a/models/operations/gettopwatchedcontent.go b/models/operations/gettopwatchedcontent.go index 7356b42..e10456d 100644 --- a/models/operations/gettopwatchedcontent.go +++ b/models/operations/gettopwatchedcontent.go @@ -1,24 +1,70 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations import ( + "encoding/json" + "fmt" "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/types" "net/http" ) +// GetTopWatchedContentQueryParamType - The type of media to retrieve. +// 1 = movie +// 2 = show +// 3 = season +// 4 = episode +// E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries +type GetTopWatchedContentQueryParamType int64 + +const ( + GetTopWatchedContentQueryParamTypeOne GetTopWatchedContentQueryParamType = 1 + GetTopWatchedContentQueryParamTypeTwo GetTopWatchedContentQueryParamType = 2 + GetTopWatchedContentQueryParamTypeThree GetTopWatchedContentQueryParamType = 3 + GetTopWatchedContentQueryParamTypeFour GetTopWatchedContentQueryParamType = 4 +) + +func (e GetTopWatchedContentQueryParamType) ToPointer() *GetTopWatchedContentQueryParamType { + return &e +} +func (e *GetTopWatchedContentQueryParamType) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 1: + fallthrough + case 2: + fallthrough + case 3: + fallthrough + case 4: + *e = GetTopWatchedContentQueryParamType(v) + return nil + default: + return fmt.Errorf("invalid value for GetTopWatchedContentQueryParamType: %v", v) + } +} + type GetTopWatchedContentRequest struct { - // the library type (1 - movies, 2 - shows, 3 - music) - Type int64 `queryParam:"style=form,explode=true,name=type"` + // The type of media to retrieve. + // 1 = movie + // 2 = show + // 3 = season + // 4 = episode + // E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries + // + Type GetTopWatchedContentQueryParamType `queryParam:"style=form,explode=true,name=type"` // Adds the Guids object to the response // IncludeGuids *int64 `queryParam:"style=form,explode=true,name=includeGuids"` } -func (o *GetTopWatchedContentRequest) GetType() int64 { +func (o *GetTopWatchedContentRequest) GetType() GetTopWatchedContentQueryParamType { if o == nil { - return 0 + return GetTopWatchedContentQueryParamType(0) } return o.Type } diff --git a/models/operations/gettranscodesessions.go b/models/operations/gettranscodesessions.go index d49240c..8c6477d 100644 --- a/models/operations/gettranscodesessions.go +++ b/models/operations/gettranscodesessions.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/gettransienttoken.go b/models/operations/gettransienttoken.go index 31f5ff1..b13137f 100644 --- a/models/operations/gettransienttoken.go +++ b/models/operations/gettransienttoken.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getupdatestatus.go b/models/operations/getupdatestatus.go index 5098156..ffe6a07 100644 --- a/models/operations/getupdatestatus.go +++ b/models/operations/getupdatestatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/getuserdetails.go b/models/operations/getuserdetails.go new file mode 100644 index 0000000..5d73f54 --- /dev/null +++ b/models/operations/getuserdetails.go @@ -0,0 +1,1316 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/LukeHagar/plexgo/internal/utils" + "net/http" + "time" +) + +var GetUserDetailsServerList = []string{ + "https://plex.tv/api/v2/", +} + +type GetUserDetailsRequest struct { + // Plex Authentication Token + XPlexToken string `queryParam:"style=form,explode=true,name=X-Plex-Token"` +} + +func (o *GetUserDetailsRequest) GetXPlexToken() string { + if o == nil { + return "" + } + return o.XPlexToken +} + +// MailingListStatus - Your current mailing list status +type MailingListStatus string + +const ( + MailingListStatusActive MailingListStatus = "active" + MailingListStatusUnsubscribed MailingListStatus = "unsubscribed" +) + +func (e MailingListStatus) ToPointer() *MailingListStatus { + return &e +} +func (e *MailingListStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "active": + fallthrough + case "unsubscribed": + *e = MailingListStatus(v) + return nil + default: + return fmt.Errorf("invalid value for MailingListStatus: %v", v) + } +} + +// AutoSelectSubtitle - The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) +type AutoSelectSubtitle string + +const ( + AutoSelectSubtitleZero AutoSelectSubtitle = "0" + AutoSelectSubtitleOne AutoSelectSubtitle = "1" +) + +func (e AutoSelectSubtitle) ToPointer() *AutoSelectSubtitle { + return &e +} +func (e *AutoSelectSubtitle) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "0": + fallthrough + case "1": + *e = AutoSelectSubtitle(v) + return nil + default: + return fmt.Errorf("invalid value for AutoSelectSubtitle: %v", v) + } +} + +// DefaultSubtitleAccessibility - The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) +type DefaultSubtitleAccessibility string + +const ( + DefaultSubtitleAccessibilityZero DefaultSubtitleAccessibility = "0" + DefaultSubtitleAccessibilityOne DefaultSubtitleAccessibility = "1" +) + +func (e DefaultSubtitleAccessibility) ToPointer() *DefaultSubtitleAccessibility { + return &e +} +func (e *DefaultSubtitleAccessibility) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "0": + fallthrough + case "1": + *e = DefaultSubtitleAccessibility(v) + return nil + default: + return fmt.Errorf("invalid value for DefaultSubtitleAccessibility: %v", v) + } +} + +// DefaultSubtitleForced - The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) +type DefaultSubtitleForced string + +const ( + DefaultSubtitleForcedZero DefaultSubtitleForced = "0" + DefaultSubtitleForcedOne DefaultSubtitleForced = "1" +) + +func (e DefaultSubtitleForced) ToPointer() *DefaultSubtitleForced { + return &e +} +func (e *DefaultSubtitleForced) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "0": + fallthrough + case "1": + *e = DefaultSubtitleForced(v) + return nil + default: + return fmt.Errorf("invalid value for DefaultSubtitleForced: %v", v) + } +} + +type WatchedIndicator string + +const ( + WatchedIndicatorZero WatchedIndicator = "0" + WatchedIndicatorOne WatchedIndicator = "1" +) + +func (e WatchedIndicator) ToPointer() *WatchedIndicator { + return &e +} +func (e *WatchedIndicator) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "0": + fallthrough + case "1": + *e = WatchedIndicator(v) + return nil + default: + return fmt.Errorf("invalid value for WatchedIndicator: %v", v) + } +} + +type MediaReviewsVisibility int64 + +const ( + MediaReviewsVisibilityZero MediaReviewsVisibility = 0 + MediaReviewsVisibilityOne MediaReviewsVisibility = 1 +) + +func (e MediaReviewsVisibility) ToPointer() *MediaReviewsVisibility { + return &e +} +func (e *MediaReviewsVisibility) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 0: + fallthrough + case 1: + *e = MediaReviewsVisibility(v) + return nil + default: + return fmt.Errorf("invalid value for MediaReviewsVisibility: %v", v) + } +} + +type UserProfile struct { + // If the account has automatically select audio and subtitle tracks enabled + AutoSelectAudio *bool `default:"true" json:"autoSelectAudio"` + // The preferred audio language for the account + DefaultAudioLanguage *string `json:"defaultAudioLanguage"` + // The preferred subtitle language for the account + DefaultSubtitleLanguage *string `json:"defaultSubtitleLanguage"` + // The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) + AutoSelectSubtitle *AutoSelectSubtitle `json:"autoSelectSubtitle,omitempty"` + // The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) + DefaultSubtitleAccessibility *DefaultSubtitleAccessibility `json:"defaultSubtitleAccessibility,omitempty"` + // The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) + DefaultSubtitleForced *DefaultSubtitleForced `json:"defaultSubtitleForced,omitempty"` + WatchedIndicator *WatchedIndicator `json:"watchedIndicator,omitempty"` + MediaReviewsVisibility *MediaReviewsVisibility `json:"mediaReviewsVisibility,omitempty"` +} + +func (u UserProfile) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(u, "", false) +} + +func (u *UserProfile) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &u, "", false, false); err != nil { + return err + } + return nil +} + +func (o *UserProfile) GetAutoSelectAudio() *bool { + if o == nil { + return nil + } + return o.AutoSelectAudio +} + +func (o *UserProfile) GetDefaultAudioLanguage() *string { + if o == nil { + return nil + } + return o.DefaultAudioLanguage +} + +func (o *UserProfile) GetDefaultSubtitleLanguage() *string { + if o == nil { + return nil + } + return o.DefaultSubtitleLanguage +} + +func (o *UserProfile) GetAutoSelectSubtitle() *AutoSelectSubtitle { + if o == nil { + return nil + } + return o.AutoSelectSubtitle +} + +func (o *UserProfile) GetDefaultSubtitleAccessibility() *DefaultSubtitleAccessibility { + if o == nil { + return nil + } + return o.DefaultSubtitleAccessibility +} + +func (o *UserProfile) GetDefaultSubtitleForced() *DefaultSubtitleForced { + if o == nil { + return nil + } + return o.DefaultSubtitleForced +} + +func (o *UserProfile) GetWatchedIndicator() *WatchedIndicator { + if o == nil { + return nil + } + return o.WatchedIndicator +} + +func (o *UserProfile) GetMediaReviewsVisibility() *MediaReviewsVisibility { + if o == nil { + return nil + } + return o.MediaReviewsVisibility +} + +type GetUserDetailsStatus string + +const ( + GetUserDetailsStatusOnline GetUserDetailsStatus = "online" + GetUserDetailsStatusOffline GetUserDetailsStatus = "offline" +) + +func (e GetUserDetailsStatus) ToPointer() *GetUserDetailsStatus { + return &e +} +func (e *GetUserDetailsStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "online": + fallthrough + case "offline": + *e = GetUserDetailsStatus(v) + return nil + default: + return fmt.Errorf("invalid value for GetUserDetailsStatus: %v", v) + } +} + +type Services struct { + Identifier string `json:"identifier"` + Endpoint string `json:"endpoint"` + Token *string `json:"token"` + Secret *string `json:"secret"` + Status GetUserDetailsStatus `json:"status"` +} + +func (o *Services) GetIdentifier() string { + if o == nil { + return "" + } + return o.Identifier +} + +func (o *Services) GetEndpoint() string { + if o == nil { + return "" + } + return o.Endpoint +} + +func (o *Services) GetToken() *string { + if o == nil { + return nil + } + return o.Token +} + +func (o *Services) GetSecret() *string { + if o == nil { + return nil + } + return o.Secret +} + +func (o *Services) GetStatus() GetUserDetailsStatus { + if o == nil { + return GetUserDetailsStatus("") + } + return o.Status +} + +type Features string + +const ( + FeaturesAndroidDolbyVision Features = "Android - Dolby Vision" + FeaturesAndroidPiP Features = "Android - PiP" + FeaturesCuSunset Features = "CU Sunset" + FeaturesHrkEnableEur Features = "HRK_enable_EUR" + FeaturesTrebleShowFeatures Features = "TREBLE-show-features" + FeaturesAdCountdownTimer Features = "ad-countdown-timer" + FeaturesAdaptiveBitrate Features = "adaptive_bitrate" + FeaturesAmazonLoopDebug Features = "amazon-loop-debug" + FeaturesAvodAdAnalysis Features = "avod-ad-analysis" + FeaturesAvodNewMedia Features = "avod-new-media" + FeaturesBlacklistGetSignin Features = "blacklist_get_signin" + FeaturesClientRadioStations Features = "client-radio-stations" + FeaturesCloudflareTurnstileRequired Features = "cloudflare-turnstile-required" + FeaturesCollections Features = "collections" + FeaturesCommentsAndRepliesPushNotifications Features = "comments_and_replies_push_notifications" + FeaturesCommunityAccessPlexTv Features = "community_access_plex_tv" + FeaturesCompanionsSonos Features = "companions_sonos" + FeaturesCustomHomeRemoval Features = "custom-home-removal" + FeaturesDisableHomeUserFriendships Features = "disable_home_user_friendships" + FeaturesDisableSharingFriendships Features = "disable_sharing_friendships" + FeaturesDrmSupport Features = "drm_support" + FeaturesExcludeRestrictions Features = "exclude restrictions" + FeaturesFederatedAuth Features = "federated-auth" + FeaturesFriendRequestPushNotifications Features = "friend_request_push_notifications" + FeaturesGuidedUpgrade Features = "guided-upgrade" + FeaturesHome Features = "home" + FeaturesIncreasePasswordComplexity Features = "increase-password-complexity" + FeaturesIos14PrivacyBanner Features = "ios14-privacy-banner" + FeaturesIterableNotificationTokens Features = "iterable-notification-tokens" + FeaturesKeepPaymentMethod Features = "keep-payment-method" + FeaturesKevinBacon Features = "kevin-bacon" + FeaturesKoreaConsent Features = "korea-consent" + FeaturesLeIsrgRootX1 Features = "le_isrg_root_x1" + FeaturesLetsEncrypt Features = "lets_encrypt" + FeaturesLightningDvrPivot Features = "lightning-dvr-pivot" + FeaturesLiveTvSupportIncompleteSegments Features = "live-tv-support-incomplete-segments" + FeaturesLivetv Features = "livetv" + FeaturesMetadataSearch Features = "metadata_search" + FeaturesNewPlexPassPrices Features = "new_plex_pass_prices" + FeaturesNewsProviderSunsetModal Features = "news-provider-sunset-modal" + FeaturesPhotosFavorites Features = "photos-favorites" + FeaturesPhotosMetadataEdition Features = "photos-metadata-edition" + FeaturesPmsHealth Features = "pms_health" + FeaturesRadio Features = "radio" + FeaturesRateLimitClientToken Features = "rate-limit-client-token" + FeaturesScrobblingServicePlexTv Features = "scrobbling-service-plex-tv" + FeaturesSharedServerNotification Features = "shared_server_notification" + FeaturesSharedSourceNotification Features = "shared_source_notification" + FeaturesSigninWithApple Features = "signin_with_apple" + FeaturesSpringServeAdProvider Features = "spring_serve_ad_provider" + FeaturesTranscoderCache Features = "transcoder_cache" + FeaturesTunerSharing Features = "tuner-sharing" + FeaturesTwoFactorAuthentication Features = "two-factor-authentication" + FeaturesUnsupportedtuners Features = "unsupportedtuners" + FeaturesUpgrade3ds2 Features = "upgrade-3ds2" + FeaturesVodSchema Features = "vod-schema" + FeaturesVodCloudflare Features = "vod_cloudflare" + FeaturesWatchTogetherInvite Features = "watch-together-invite" + FeaturesWebServerDashboard Features = "web_server_dashboard" +) + +func (e Features) ToPointer() *Features { + return &e +} +func (e *Features) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Android - Dolby Vision": + fallthrough + case "Android - PiP": + fallthrough + case "CU Sunset": + fallthrough + case "HRK_enable_EUR": + fallthrough + case "TREBLE-show-features": + fallthrough + case "ad-countdown-timer": + fallthrough + case "adaptive_bitrate": + fallthrough + case "amazon-loop-debug": + fallthrough + case "avod-ad-analysis": + fallthrough + case "avod-new-media": + fallthrough + case "blacklist_get_signin": + fallthrough + case "client-radio-stations": + fallthrough + case "cloudflare-turnstile-required": + fallthrough + case "collections": + fallthrough + case "comments_and_replies_push_notifications": + fallthrough + case "community_access_plex_tv": + fallthrough + case "companions_sonos": + fallthrough + case "custom-home-removal": + fallthrough + case "disable_home_user_friendships": + fallthrough + case "disable_sharing_friendships": + fallthrough + case "drm_support": + fallthrough + case "exclude restrictions": + fallthrough + case "federated-auth": + fallthrough + case "friend_request_push_notifications": + fallthrough + case "guided-upgrade": + fallthrough + case "home": + fallthrough + case "increase-password-complexity": + fallthrough + case "ios14-privacy-banner": + fallthrough + case "iterable-notification-tokens": + fallthrough + case "keep-payment-method": + fallthrough + case "kevin-bacon": + fallthrough + case "korea-consent": + fallthrough + case "le_isrg_root_x1": + fallthrough + case "lets_encrypt": + fallthrough + case "lightning-dvr-pivot": + fallthrough + case "live-tv-support-incomplete-segments": + fallthrough + case "livetv": + fallthrough + case "metadata_search": + fallthrough + case "new_plex_pass_prices": + fallthrough + case "news-provider-sunset-modal": + fallthrough + case "photos-favorites": + fallthrough + case "photos-metadata-edition": + fallthrough + case "pms_health": + fallthrough + case "radio": + fallthrough + case "rate-limit-client-token": + fallthrough + case "scrobbling-service-plex-tv": + fallthrough + case "shared_server_notification": + fallthrough + case "shared_source_notification": + fallthrough + case "signin_with_apple": + fallthrough + case "spring_serve_ad_provider": + fallthrough + case "transcoder_cache": + fallthrough + case "tuner-sharing": + fallthrough + case "two-factor-authentication": + fallthrough + case "unsupportedtuners": + fallthrough + case "upgrade-3ds2": + fallthrough + case "vod-schema": + fallthrough + case "vod_cloudflare": + fallthrough + case "watch-together-invite": + fallthrough + case "web_server_dashboard": + *e = Features(v) + return nil + default: + return fmt.Errorf("invalid value for Features: %v", v) + } +} + +// GetUserDetailsAuthenticationStatus - String representation of subscriptionActive +type GetUserDetailsAuthenticationStatus string + +const ( + GetUserDetailsAuthenticationStatusInactive GetUserDetailsAuthenticationStatus = "Inactive" + GetUserDetailsAuthenticationStatusActive GetUserDetailsAuthenticationStatus = "Active" +) + +func (e GetUserDetailsAuthenticationStatus) ToPointer() *GetUserDetailsAuthenticationStatus { + return &e +} +func (e *GetUserDetailsAuthenticationStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Inactive": + fallthrough + case "Active": + *e = GetUserDetailsAuthenticationStatus(v) + return nil + default: + return fmt.Errorf("invalid value for GetUserDetailsAuthenticationStatus: %v", v) + } +} + +// Subscription - If the account’s Plex Pass subscription is active +type Subscription struct { + // List of features allowed on your Plex Pass subscription + Features []Features `json:"features,omitempty"` + // If the account's Plex Pass subscription is active + Active *bool `json:"active,omitempty"` + // Date the account subscribed to Plex Pass + SubscribedAt *string `json:"subscribedAt,omitempty"` + // String representation of subscriptionActive + Status *GetUserDetailsAuthenticationStatus `json:"status,omitempty"` + // Payment service used for your Plex Pass subscription + PaymentService *string `json:"paymentService,omitempty"` + // Name of Plex Pass subscription plan + Plan *string `json:"plan,omitempty"` +} + +func (o *Subscription) GetFeatures() []Features { + if o == nil { + return nil + } + return o.Features +} + +func (o *Subscription) GetActive() *bool { + if o == nil { + return nil + } + return o.Active +} + +func (o *Subscription) GetSubscribedAt() *string { + if o == nil { + return nil + } + return o.SubscribedAt +} + +func (o *Subscription) GetStatus() *GetUserDetailsAuthenticationStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *Subscription) GetPaymentService() *string { + if o == nil { + return nil + } + return o.PaymentService +} + +func (o *Subscription) GetPlan() *string { + if o == nil { + return nil + } + return o.Plan +} + +type GetUserDetailsFeatures string + +const ( + GetUserDetailsFeaturesAndroidDolbyVision GetUserDetailsFeatures = "Android - Dolby Vision" + GetUserDetailsFeaturesAndroidPiP GetUserDetailsFeatures = "Android - PiP" + GetUserDetailsFeaturesCuSunset GetUserDetailsFeatures = "CU Sunset" + GetUserDetailsFeaturesHrkEnableEur GetUserDetailsFeatures = "HRK_enable_EUR" + GetUserDetailsFeaturesTrebleShowFeatures GetUserDetailsFeatures = "TREBLE-show-features" + GetUserDetailsFeaturesAdCountdownTimer GetUserDetailsFeatures = "ad-countdown-timer" + GetUserDetailsFeaturesAdaptiveBitrate GetUserDetailsFeatures = "adaptive_bitrate" + GetUserDetailsFeaturesAmazonLoopDebug GetUserDetailsFeatures = "amazon-loop-debug" + GetUserDetailsFeaturesAvodAdAnalysis GetUserDetailsFeatures = "avod-ad-analysis" + GetUserDetailsFeaturesAvodNewMedia GetUserDetailsFeatures = "avod-new-media" + GetUserDetailsFeaturesBlacklistGetSignin GetUserDetailsFeatures = "blacklist_get_signin" + GetUserDetailsFeaturesClientRadioStations GetUserDetailsFeatures = "client-radio-stations" + GetUserDetailsFeaturesCloudflareTurnstileRequired GetUserDetailsFeatures = "cloudflare-turnstile-required" + GetUserDetailsFeaturesCollections GetUserDetailsFeatures = "collections" + GetUserDetailsFeaturesCommentsAndRepliesPushNotifications GetUserDetailsFeatures = "comments_and_replies_push_notifications" + GetUserDetailsFeaturesCommunityAccessPlexTv GetUserDetailsFeatures = "community_access_plex_tv" + GetUserDetailsFeaturesCompanionsSonos GetUserDetailsFeatures = "companions_sonos" + GetUserDetailsFeaturesCustomHomeRemoval GetUserDetailsFeatures = "custom-home-removal" + GetUserDetailsFeaturesDisableHomeUserFriendships GetUserDetailsFeatures = "disable_home_user_friendships" + GetUserDetailsFeaturesDisableSharingFriendships GetUserDetailsFeatures = "disable_sharing_friendships" + GetUserDetailsFeaturesDrmSupport GetUserDetailsFeatures = "drm_support" + GetUserDetailsFeaturesExcludeRestrictions GetUserDetailsFeatures = "exclude restrictions" + GetUserDetailsFeaturesFederatedAuth GetUserDetailsFeatures = "federated-auth" + GetUserDetailsFeaturesFriendRequestPushNotifications GetUserDetailsFeatures = "friend_request_push_notifications" + GetUserDetailsFeaturesGuidedUpgrade GetUserDetailsFeatures = "guided-upgrade" + GetUserDetailsFeaturesHome GetUserDetailsFeatures = "home" + GetUserDetailsFeaturesIncreasePasswordComplexity GetUserDetailsFeatures = "increase-password-complexity" + GetUserDetailsFeaturesIos14PrivacyBanner GetUserDetailsFeatures = "ios14-privacy-banner" + GetUserDetailsFeaturesIterableNotificationTokens GetUserDetailsFeatures = "iterable-notification-tokens" + GetUserDetailsFeaturesKeepPaymentMethod GetUserDetailsFeatures = "keep-payment-method" + GetUserDetailsFeaturesKevinBacon GetUserDetailsFeatures = "kevin-bacon" + GetUserDetailsFeaturesKoreaConsent GetUserDetailsFeatures = "korea-consent" + GetUserDetailsFeaturesLeIsrgRootX1 GetUserDetailsFeatures = "le_isrg_root_x1" + GetUserDetailsFeaturesLetsEncrypt GetUserDetailsFeatures = "lets_encrypt" + GetUserDetailsFeaturesLightningDvrPivot GetUserDetailsFeatures = "lightning-dvr-pivot" + GetUserDetailsFeaturesLiveTvSupportIncompleteSegments GetUserDetailsFeatures = "live-tv-support-incomplete-segments" + GetUserDetailsFeaturesLivetv GetUserDetailsFeatures = "livetv" + GetUserDetailsFeaturesMetadataSearch GetUserDetailsFeatures = "metadata_search" + GetUserDetailsFeaturesNewPlexPassPrices GetUserDetailsFeatures = "new_plex_pass_prices" + GetUserDetailsFeaturesNewsProviderSunsetModal GetUserDetailsFeatures = "news-provider-sunset-modal" + GetUserDetailsFeaturesPhotosFavorites GetUserDetailsFeatures = "photos-favorites" + GetUserDetailsFeaturesPhotosMetadataEdition GetUserDetailsFeatures = "photos-metadata-edition" + GetUserDetailsFeaturesPmsHealth GetUserDetailsFeatures = "pms_health" + GetUserDetailsFeaturesRadio GetUserDetailsFeatures = "radio" + GetUserDetailsFeaturesRateLimitClientToken GetUserDetailsFeatures = "rate-limit-client-token" + GetUserDetailsFeaturesScrobblingServicePlexTv GetUserDetailsFeatures = "scrobbling-service-plex-tv" + GetUserDetailsFeaturesSharedServerNotification GetUserDetailsFeatures = "shared_server_notification" + GetUserDetailsFeaturesSharedSourceNotification GetUserDetailsFeatures = "shared_source_notification" + GetUserDetailsFeaturesSigninWithApple GetUserDetailsFeatures = "signin_with_apple" + GetUserDetailsFeaturesSpringServeAdProvider GetUserDetailsFeatures = "spring_serve_ad_provider" + GetUserDetailsFeaturesTranscoderCache GetUserDetailsFeatures = "transcoder_cache" + GetUserDetailsFeaturesTunerSharing GetUserDetailsFeatures = "tuner-sharing" + GetUserDetailsFeaturesTwoFactorAuthentication GetUserDetailsFeatures = "two-factor-authentication" + GetUserDetailsFeaturesUnsupportedtuners GetUserDetailsFeatures = "unsupportedtuners" + GetUserDetailsFeaturesUpgrade3ds2 GetUserDetailsFeatures = "upgrade-3ds2" + GetUserDetailsFeaturesVodSchema GetUserDetailsFeatures = "vod-schema" + GetUserDetailsFeaturesVodCloudflare GetUserDetailsFeatures = "vod_cloudflare" + GetUserDetailsFeaturesWatchTogetherInvite GetUserDetailsFeatures = "watch-together-invite" + GetUserDetailsFeaturesWebServerDashboard GetUserDetailsFeatures = "web_server_dashboard" +) + +func (e GetUserDetailsFeatures) ToPointer() *GetUserDetailsFeatures { + return &e +} +func (e *GetUserDetailsFeatures) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Android - Dolby Vision": + fallthrough + case "Android - PiP": + fallthrough + case "CU Sunset": + fallthrough + case "HRK_enable_EUR": + fallthrough + case "TREBLE-show-features": + fallthrough + case "ad-countdown-timer": + fallthrough + case "adaptive_bitrate": + fallthrough + case "amazon-loop-debug": + fallthrough + case "avod-ad-analysis": + fallthrough + case "avod-new-media": + fallthrough + case "blacklist_get_signin": + fallthrough + case "client-radio-stations": + fallthrough + case "cloudflare-turnstile-required": + fallthrough + case "collections": + fallthrough + case "comments_and_replies_push_notifications": + fallthrough + case "community_access_plex_tv": + fallthrough + case "companions_sonos": + fallthrough + case "custom-home-removal": + fallthrough + case "disable_home_user_friendships": + fallthrough + case "disable_sharing_friendships": + fallthrough + case "drm_support": + fallthrough + case "exclude restrictions": + fallthrough + case "federated-auth": + fallthrough + case "friend_request_push_notifications": + fallthrough + case "guided-upgrade": + fallthrough + case "home": + fallthrough + case "increase-password-complexity": + fallthrough + case "ios14-privacy-banner": + fallthrough + case "iterable-notification-tokens": + fallthrough + case "keep-payment-method": + fallthrough + case "kevin-bacon": + fallthrough + case "korea-consent": + fallthrough + case "le_isrg_root_x1": + fallthrough + case "lets_encrypt": + fallthrough + case "lightning-dvr-pivot": + fallthrough + case "live-tv-support-incomplete-segments": + fallthrough + case "livetv": + fallthrough + case "metadata_search": + fallthrough + case "new_plex_pass_prices": + fallthrough + case "news-provider-sunset-modal": + fallthrough + case "photos-favorites": + fallthrough + case "photos-metadata-edition": + fallthrough + case "pms_health": + fallthrough + case "radio": + fallthrough + case "rate-limit-client-token": + fallthrough + case "scrobbling-service-plex-tv": + fallthrough + case "shared_server_notification": + fallthrough + case "shared_source_notification": + fallthrough + case "signin_with_apple": + fallthrough + case "spring_serve_ad_provider": + fallthrough + case "transcoder_cache": + fallthrough + case "tuner-sharing": + fallthrough + case "two-factor-authentication": + fallthrough + case "unsupportedtuners": + fallthrough + case "upgrade-3ds2": + fallthrough + case "vod-schema": + fallthrough + case "vod_cloudflare": + fallthrough + case "watch-together-invite": + fallthrough + case "web_server_dashboard": + *e = GetUserDetailsFeatures(v) + return nil + default: + return fmt.Errorf("invalid value for GetUserDetailsFeatures: %v", v) + } +} + +// GetUserDetailsAuthenticationResponseStatus - String representation of subscriptionActive +type GetUserDetailsAuthenticationResponseStatus string + +const ( + GetUserDetailsAuthenticationResponseStatusInactive GetUserDetailsAuthenticationResponseStatus = "Inactive" + GetUserDetailsAuthenticationResponseStatusActive GetUserDetailsAuthenticationResponseStatus = "Active" +) + +func (e GetUserDetailsAuthenticationResponseStatus) ToPointer() *GetUserDetailsAuthenticationResponseStatus { + return &e +} +func (e *GetUserDetailsAuthenticationResponseStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Inactive": + fallthrough + case "Active": + *e = GetUserDetailsAuthenticationResponseStatus(v) + return nil + default: + return fmt.Errorf("invalid value for GetUserDetailsAuthenticationResponseStatus: %v", v) + } +} + +type GetUserDetailsSubscription struct { + // List of features allowed on your Plex Pass subscription + Features []GetUserDetailsFeatures `json:"features,omitempty"` + // If the account's Plex Pass subscription is active + Active *bool `json:"active,omitempty"` + // Date the account subscribed to Plex Pass + SubscribedAt *string `json:"subscribedAt,omitempty"` + // String representation of subscriptionActive + Status *GetUserDetailsAuthenticationResponseStatus `json:"status,omitempty"` + // Payment service used for your Plex Pass subscription + PaymentService *string `json:"paymentService,omitempty"` + // Name of Plex Pass subscription plan + Plan *string `json:"plan,omitempty"` +} + +func (o *GetUserDetailsSubscription) GetFeatures() []GetUserDetailsFeatures { + if o == nil { + return nil + } + return o.Features +} + +func (o *GetUserDetailsSubscription) GetActive() *bool { + if o == nil { + return nil + } + return o.Active +} + +func (o *GetUserDetailsSubscription) GetSubscribedAt() *string { + if o == nil { + return nil + } + return o.SubscribedAt +} + +func (o *GetUserDetailsSubscription) GetStatus() *GetUserDetailsAuthenticationResponseStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *GetUserDetailsSubscription) GetPaymentService() *string { + if o == nil { + return nil + } + return o.PaymentService +} + +func (o *GetUserDetailsSubscription) GetPlan() *string { + if o == nil { + return nil + } + return o.Plan +} + +// GetUserDetailsUserPlexAccount - Logged in user details +type GetUserDetailsUserPlexAccount struct { + // Unknown + AdsConsent *bool `json:"adsConsent"` + // Unknown + AdsConsentReminderAt *time.Time `json:"adsConsentReminderAt"` + // Unknown + AdsConsentSetAt *time.Time `json:"adsConsentSetAt"` + // Unknown + Anonymous *bool `default:"false" json:"anonymous"` + // The account token + AuthToken string `json:"authToken"` + // If the two-factor authentication backup codes have been created + BackupCodesCreated *bool `default:"false" json:"backupCodesCreated"` + // If the account has been confirmed + Confirmed *bool `default:"false" json:"confirmed"` + // The account country + Country string `json:"country"` + // The account email address + Email string `json:"email"` + // If login with email only is enabled + EmailOnlyAuth *bool `default:"false" json:"emailOnlyAuth"` + // If experimental features are enabled + ExperimentalFeatures *bool `default:"false" json:"experimentalFeatures"` + // Your account full name + FriendlyName string `json:"friendlyName"` + // List of devices your allowed to use with this account + Entitlements []string `json:"entitlements"` + // If the account is a Plex Home guest user + Guest *bool `default:"false" json:"guest"` + // If the account has a password + HasPassword *bool `default:"true" json:"hasPassword"` + // If the account is a Plex Home user + Home *bool `default:"false" json:"home"` + // If the account is the Plex Home admin + HomeAdmin *bool `default:"false" json:"homeAdmin"` + // The number of accounts in the Plex Home + HomeSize int `json:"homeSize"` + // The Plex account ID + ID int `json:"id"` + // Unix epoch datetime + JoinedAt int64 `json:"joinedAt"` + // The account locale + Locale *string `json:"locale"` + // If you are subscribed to the Plex newsletter + MailingListActive *bool `default:"false" json:"mailingListActive"` + // Your current mailing list status + MailingListStatus MailingListStatus `json:"mailingListStatus"` + // The maximum number of accounts allowed in the Plex Home + MaxHomeSize int `json:"maxHomeSize"` + // [Might be removed] The hashed Plex Home PIN + // + // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + Pin *string `json:"pin,omitempty"` + Profile UserProfile `json:"profile"` + // If the account has a Plex Home PIN enabled + Protected *bool `default:"false" json:"protected"` + // Unix epoch datetime + RememberExpiresAt int64 `json:"rememberExpiresAt"` + // If the account is a Plex Home managed user + Restricted *bool `default:"false" json:"restricted"` + // [Might be removed] List of account roles. Plexpass membership listed here + Roles []string `json:"roles,omitempty"` + // Unknown + ScrobbleTypes string `json:"scrobbleTypes"` + Services []Services `json:"services"` + // If the account’s Plex Pass subscription is active + Subscription Subscription `json:"subscription"` + // Description of the Plex Pass subscription + SubscriptionDescription *string `json:"subscriptionDescription"` + Subscriptions []GetUserDetailsSubscription `json:"subscriptions"` + // URL of the account thumbnail + Thumb string `json:"thumb"` + // The title of the account (username or friendly name) + Title string `json:"title"` + // If two-factor authentication is enabled + TwoFactorEnabled *bool `default:"false" json:"twoFactorEnabled"` + // The account username + Username string `json:"username"` + // The account UUID + UUID string `json:"uuid"` +} + +func (g GetUserDetailsUserPlexAccount) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetUserDetailsUserPlexAccount) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetUserDetailsUserPlexAccount) GetAdsConsent() *bool { + if o == nil { + return nil + } + return o.AdsConsent +} + +func (o *GetUserDetailsUserPlexAccount) GetAdsConsentReminderAt() *time.Time { + if o == nil { + return nil + } + return o.AdsConsentReminderAt +} + +func (o *GetUserDetailsUserPlexAccount) GetAdsConsentSetAt() *time.Time { + if o == nil { + return nil + } + return o.AdsConsentSetAt +} + +func (o *GetUserDetailsUserPlexAccount) GetAnonymous() *bool { + if o == nil { + return nil + } + return o.Anonymous +} + +func (o *GetUserDetailsUserPlexAccount) GetAuthToken() string { + if o == nil { + return "" + } + return o.AuthToken +} + +func (o *GetUserDetailsUserPlexAccount) GetBackupCodesCreated() *bool { + if o == nil { + return nil + } + return o.BackupCodesCreated +} + +func (o *GetUserDetailsUserPlexAccount) GetConfirmed() *bool { + if o == nil { + return nil + } + return o.Confirmed +} + +func (o *GetUserDetailsUserPlexAccount) GetCountry() string { + if o == nil { + return "" + } + return o.Country +} + +func (o *GetUserDetailsUserPlexAccount) GetEmail() string { + if o == nil { + return "" + } + return o.Email +} + +func (o *GetUserDetailsUserPlexAccount) GetEmailOnlyAuth() *bool { + if o == nil { + return nil + } + return o.EmailOnlyAuth +} + +func (o *GetUserDetailsUserPlexAccount) GetExperimentalFeatures() *bool { + if o == nil { + return nil + } + return o.ExperimentalFeatures +} + +func (o *GetUserDetailsUserPlexAccount) GetFriendlyName() string { + if o == nil { + return "" + } + return o.FriendlyName +} + +func (o *GetUserDetailsUserPlexAccount) GetEntitlements() []string { + if o == nil { + return []string{} + } + return o.Entitlements +} + +func (o *GetUserDetailsUserPlexAccount) GetGuest() *bool { + if o == nil { + return nil + } + return o.Guest +} + +func (o *GetUserDetailsUserPlexAccount) GetHasPassword() *bool { + if o == nil { + return nil + } + return o.HasPassword +} + +func (o *GetUserDetailsUserPlexAccount) GetHome() *bool { + if o == nil { + return nil + } + return o.Home +} + +func (o *GetUserDetailsUserPlexAccount) GetHomeAdmin() *bool { + if o == nil { + return nil + } + return o.HomeAdmin +} + +func (o *GetUserDetailsUserPlexAccount) GetHomeSize() int { + if o == nil { + return 0 + } + return o.HomeSize +} + +func (o *GetUserDetailsUserPlexAccount) GetID() int { + if o == nil { + return 0 + } + return o.ID +} + +func (o *GetUserDetailsUserPlexAccount) GetJoinedAt() int64 { + if o == nil { + return 0 + } + return o.JoinedAt +} + +func (o *GetUserDetailsUserPlexAccount) GetLocale() *string { + if o == nil { + return nil + } + return o.Locale +} + +func (o *GetUserDetailsUserPlexAccount) GetMailingListActive() *bool { + if o == nil { + return nil + } + return o.MailingListActive +} + +func (o *GetUserDetailsUserPlexAccount) GetMailingListStatus() MailingListStatus { + if o == nil { + return MailingListStatus("") + } + return o.MailingListStatus +} + +func (o *GetUserDetailsUserPlexAccount) GetMaxHomeSize() int { + if o == nil { + return 0 + } + return o.MaxHomeSize +} + +func (o *GetUserDetailsUserPlexAccount) GetPin() *string { + if o == nil { + return nil + } + return o.Pin +} + +func (o *GetUserDetailsUserPlexAccount) GetProfile() UserProfile { + if o == nil { + return UserProfile{} + } + return o.Profile +} + +func (o *GetUserDetailsUserPlexAccount) GetProtected() *bool { + if o == nil { + return nil + } + return o.Protected +} + +func (o *GetUserDetailsUserPlexAccount) GetRememberExpiresAt() int64 { + if o == nil { + return 0 + } + return o.RememberExpiresAt +} + +func (o *GetUserDetailsUserPlexAccount) GetRestricted() *bool { + if o == nil { + return nil + } + return o.Restricted +} + +func (o *GetUserDetailsUserPlexAccount) GetRoles() []string { + if o == nil { + return nil + } + return o.Roles +} + +func (o *GetUserDetailsUserPlexAccount) GetScrobbleTypes() string { + if o == nil { + return "" + } + return o.ScrobbleTypes +} + +func (o *GetUserDetailsUserPlexAccount) GetServices() []Services { + if o == nil { + return []Services{} + } + return o.Services +} + +func (o *GetUserDetailsUserPlexAccount) GetSubscription() Subscription { + if o == nil { + return Subscription{} + } + return o.Subscription +} + +func (o *GetUserDetailsUserPlexAccount) GetSubscriptionDescription() *string { + if o == nil { + return nil + } + return o.SubscriptionDescription +} + +func (o *GetUserDetailsUserPlexAccount) GetSubscriptions() []GetUserDetailsSubscription { + if o == nil { + return []GetUserDetailsSubscription{} + } + return o.Subscriptions +} + +func (o *GetUserDetailsUserPlexAccount) GetThumb() string { + if o == nil { + return "" + } + return o.Thumb +} + +func (o *GetUserDetailsUserPlexAccount) GetTitle() string { + if o == nil { + return "" + } + return o.Title +} + +func (o *GetUserDetailsUserPlexAccount) GetTwoFactorEnabled() *bool { + if o == nil { + return nil + } + return o.TwoFactorEnabled +} + +func (o *GetUserDetailsUserPlexAccount) GetUsername() string { + if o == nil { + return "" + } + return o.Username +} + +func (o *GetUserDetailsUserPlexAccount) GetUUID() string { + if o == nil { + return "" + } + return o.UUID +} + +type GetUserDetailsResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Logged in user details + UserPlexAccount *GetUserDetailsUserPlexAccount +} + +func (o *GetUserDetailsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetUserDetailsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetUserDetailsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetUserDetailsResponse) GetUserPlexAccount() *GetUserDetailsUserPlexAccount { + if o == nil { + return nil + } + return o.UserPlexAccount +} diff --git a/models/operations/getuserfriends.go b/models/operations/getuserfriends.go new file mode 100644 index 0000000..80c903f --- /dev/null +++ b/models/operations/getuserfriends.go @@ -0,0 +1,203 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/LukeHagar/plexgo/internal/utils" + "net/http" +) + +var GetUserFriendsServerList = []string{ + "https://plex.tv/api/v2/", +} + +type SharedServers struct { +} + +type SharedSources struct { +} + +// Status - Current friend request status +type Status string + +const ( + StatusAccepted Status = "accepted" +) + +func (e Status) ToPointer() *Status { + return &e +} +func (e *Status) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "accepted": + *e = Status(v) + return nil + default: + return fmt.Errorf("invalid value for Status: %v", v) + } +} + +type Friend struct { + // The account email address + Email string `json:"email"` + // The account full name + FriendlyName *string `json:"friendlyName"` + // If the account is a Plex Home user + Home bool `json:"home"` + // The Plex account ID + ID int `json:"id"` + // If the account is a Plex Home managed user + Restricted *bool `default:"false" json:"restricted"` + SharedServers []SharedServers `json:"sharedServers"` + SharedSources []SharedSources `json:"sharedSources"` + // Current friend request status + Status Status `json:"status"` + // URL of the account thumbnail + Thumb string `json:"thumb"` + // The title of the account (username or friendly name) + Title string `json:"title"` + // The account username + Username string `json:"username"` + // The account Universally Unique Identifier (UUID) + UUID string `json:"uuid"` +} + +func (f Friend) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(f, "", false) +} + +func (f *Friend) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &f, "", false, false); err != nil { + return err + } + return nil +} + +func (o *Friend) GetEmail() string { + if o == nil { + return "" + } + return o.Email +} + +func (o *Friend) GetFriendlyName() *string { + if o == nil { + return nil + } + return o.FriendlyName +} + +func (o *Friend) GetHome() bool { + if o == nil { + return false + } + return o.Home +} + +func (o *Friend) GetID() int { + if o == nil { + return 0 + } + return o.ID +} + +func (o *Friend) GetRestricted() *bool { + if o == nil { + return nil + } + return o.Restricted +} + +func (o *Friend) GetSharedServers() []SharedServers { + if o == nil { + return []SharedServers{} + } + return o.SharedServers +} + +func (o *Friend) GetSharedSources() []SharedSources { + if o == nil { + return []SharedSources{} + } + return o.SharedSources +} + +func (o *Friend) GetStatus() Status { + if o == nil { + return Status("") + } + return o.Status +} + +func (o *Friend) GetThumb() string { + if o == nil { + return "" + } + return o.Thumb +} + +func (o *Friend) GetTitle() string { + if o == nil { + return "" + } + return o.Title +} + +func (o *Friend) GetUsername() string { + if o == nil { + return "" + } + return o.Username +} + +func (o *Friend) GetUUID() string { + if o == nil { + return "" + } + return o.UUID +} + +type GetUserFriendsResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Friends Data + Friends []Friend +} + +func (o *GetUserFriendsResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *GetUserFriendsResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *GetUserFriendsResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *GetUserFriendsResponse) GetFriends() []Friend { + if o == nil { + return nil + } + return o.Friends +} diff --git a/models/operations/getwatchlist.go b/models/operations/getwatchlist.go index 8a75cb2..68716aa 100644 --- a/models/operations/getwatchlist.go +++ b/models/operations/getwatchlist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -10,23 +10,23 @@ import ( "net/http" ) -var GetWatchlistServerList = []string{ +var GetWatchListServerList = []string{ "https://metadata.provider.plex.tv", } -// PathParamFilter - Filter -type PathParamFilter string +// Filter +type Filter string const ( - PathParamFilterAll PathParamFilter = "all" - PathParamFilterAvailable PathParamFilter = "available" - PathParamFilterReleased PathParamFilter = "released" + FilterAll Filter = "all" + FilterAvailable Filter = "available" + FilterReleased Filter = "released" ) -func (e PathParamFilter) ToPointer() *PathParamFilter { +func (e Filter) ToPointer() *Filter { return &e } -func (e *PathParamFilter) UnmarshalJSON(data []byte) error { +func (e *Filter) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -37,10 +37,10 @@ func (e *PathParamFilter) UnmarshalJSON(data []byte) error { case "available": fallthrough case "released": - *e = PathParamFilter(v) + *e = Filter(v) return nil default: - return fmt.Errorf("invalid value for PathParamFilter: %v", v) + return fmt.Errorf("invalid value for Filter: %v", v) } } @@ -125,9 +125,9 @@ func (e *IncludeExternalMedia) UnmarshalJSON(data []byte) error { } } -type GetWatchlistRequest struct { +type GetWatchListRequest struct { // Filter - Filter PathParamFilter `pathParam:"style=simple,explode=false,name=filter"` + Filter Filter `pathParam:"style=simple,explode=false,name=filter"` // In the format "field:dir". Available fields are "watchlistedAt" (Added At), // "titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating). // "dir" can be "asc" or "desc" @@ -146,81 +146,94 @@ type GetWatchlistRequest struct { // include external media in the results // IncludeExternalMedia *IncludeExternalMedia `queryParam:"style=form,explode=true,name=includeExternalMedia"` - // User Token - XPlexToken string `queryParam:"style=form,explode=true,name=X-Plex-Token"` // The index of the first item to return. If not specified, the first item will be returned. // If the number of items exceeds the limit, the response will be paginated. + // By default this is 0 // - XPlexContainerStart *int `queryParam:"style=form,explode=true,name=X-Plex-Container-Start"` + XPlexContainerStart *int `default:"0" queryParam:"style=form,explode=true,name=X-Plex-Container-Start"` // The number of items to return. If not specified, all items will be returned. // If the number of items exceeds the limit, the response will be paginated. + // By default this is 50 // - XPlexContainerSize *int `queryParam:"style=form,explode=true,name=X-Plex-Container-Size"` + XPlexContainerSize *int `default:"50" queryParam:"style=form,explode=true,name=X-Plex-Container-Size"` + // Plex Authentication Token + XPlexToken string `queryParam:"style=form,explode=true,name=X-Plex-Token"` } -func (o *GetWatchlistRequest) GetFilter() PathParamFilter { +func (g GetWatchListRequest) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(g, "", false) +} + +func (g *GetWatchListRequest) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil { + return err + } + return nil +} + +func (o *GetWatchListRequest) GetFilter() Filter { if o == nil { - return PathParamFilter("") + return Filter("") } return o.Filter } -func (o *GetWatchlistRequest) GetSort() *string { +func (o *GetWatchListRequest) GetSort() *string { if o == nil { return nil } return o.Sort } -func (o *GetWatchlistRequest) GetLibtype() *Libtype { +func (o *GetWatchListRequest) GetLibtype() *Libtype { if o == nil { return nil } return o.Libtype } -func (o *GetWatchlistRequest) GetMaxresults() *int { +func (o *GetWatchListRequest) GetMaxresults() *int { if o == nil { return nil } return o.Maxresults } -func (o *GetWatchlistRequest) GetIncludeCollections() *IncludeCollections { +func (o *GetWatchListRequest) GetIncludeCollections() *IncludeCollections { if o == nil { return nil } return o.IncludeCollections } -func (o *GetWatchlistRequest) GetIncludeExternalMedia() *IncludeExternalMedia { +func (o *GetWatchListRequest) GetIncludeExternalMedia() *IncludeExternalMedia { if o == nil { return nil } return o.IncludeExternalMedia } -func (o *GetWatchlistRequest) GetXPlexToken() string { - if o == nil { - return "" - } - return o.XPlexToken -} - -func (o *GetWatchlistRequest) GetXPlexContainerStart() *int { +func (o *GetWatchListRequest) GetXPlexContainerStart() *int { if o == nil { return nil } return o.XPlexContainerStart } -func (o *GetWatchlistRequest) GetXPlexContainerSize() *int { +func (o *GetWatchListRequest) GetXPlexContainerSize() *int { if o == nil { return nil } return o.XPlexContainerSize } +func (o *GetWatchListRequest) GetXPlexToken() string { + if o == nil { + return "" + } + return o.XPlexToken +} + type Image struct { Alt *string `json:"alt,omitempty"` Type *string `json:"type,omitempty"` @@ -542,8 +555,8 @@ func (o *Metadata) GetPlayableKey() *string { return o.PlayableKey } -// GetWatchlistResponseBody - Watchlist Data -type GetWatchlistResponseBody struct { +// GetWatchListResponseBody - Watchlist Data +type GetWatchListResponseBody struct { LibrarySectionID *string `json:"librarySectionID,omitempty"` LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"` Offset *int `json:"offset,omitempty"` @@ -553,56 +566,56 @@ type GetWatchlistResponseBody struct { Metadata []Metadata `json:"Metadata,omitempty"` } -func (o *GetWatchlistResponseBody) GetLibrarySectionID() *string { +func (o *GetWatchListResponseBody) GetLibrarySectionID() *string { if o == nil { return nil } return o.LibrarySectionID } -func (o *GetWatchlistResponseBody) GetLibrarySectionTitle() *string { +func (o *GetWatchListResponseBody) GetLibrarySectionTitle() *string { if o == nil { return nil } return o.LibrarySectionTitle } -func (o *GetWatchlistResponseBody) GetOffset() *int { +func (o *GetWatchListResponseBody) GetOffset() *int { if o == nil { return nil } return o.Offset } -func (o *GetWatchlistResponseBody) GetTotalSize() *int { +func (o *GetWatchListResponseBody) GetTotalSize() *int { if o == nil { return nil } return o.TotalSize } -func (o *GetWatchlistResponseBody) GetIdentifier() *string { +func (o *GetWatchListResponseBody) GetIdentifier() *string { if o == nil { return nil } return o.Identifier } -func (o *GetWatchlistResponseBody) GetSize() *int { +func (o *GetWatchListResponseBody) GetSize() *int { if o == nil { return nil } return o.Size } -func (o *GetWatchlistResponseBody) GetMetadata() []Metadata { +func (o *GetWatchListResponseBody) GetMetadata() []Metadata { if o == nil { return nil } return o.Metadata } -type GetWatchlistResponse struct { +type GetWatchListResponse struct { // HTTP response content type for this operation ContentType string // HTTP response status code for this operation @@ -610,31 +623,31 @@ type GetWatchlistResponse struct { // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response // Watchlist Data - Object *GetWatchlistResponseBody + Object *GetWatchListResponseBody } -func (o *GetWatchlistResponse) GetContentType() string { +func (o *GetWatchListResponse) GetContentType() string { if o == nil { return "" } return o.ContentType } -func (o *GetWatchlistResponse) GetStatusCode() int { +func (o *GetWatchListResponse) GetStatusCode() int { if o == nil { return 0 } return o.StatusCode } -func (o *GetWatchlistResponse) GetRawResponse() *http.Response { +func (o *GetWatchListResponse) GetRawResponse() *http.Response { if o == nil { return nil } return o.RawResponse } -func (o *GetWatchlistResponse) GetObject() *GetWatchlistResponseBody { +func (o *GetWatchListResponse) GetObject() *GetWatchListResponseBody { if o == nil { return nil } diff --git a/models/operations/logline.go b/models/operations/logline.go index 875dcca..0b11022 100644 --- a/models/operations/logline.go +++ b/models/operations/logline.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/logmultiline.go b/models/operations/logmultiline.go index 7f64ee3..d0879e4 100644 --- a/models/operations/logmultiline.go +++ b/models/operations/logmultiline.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/markplayed.go b/models/operations/markplayed.go index f82e093..8f5ae5c 100644 --- a/models/operations/markplayed.go +++ b/models/operations/markplayed.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/markunplayed.go b/models/operations/markunplayed.go index e033978..abc658b 100644 --- a/models/operations/markunplayed.go +++ b/models/operations/markunplayed.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/options.go b/models/operations/options.go index 3c31ac9..b0b2165 100644 --- a/models/operations/options.go +++ b/models/operations/options.go @@ -1,10 +1,12 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations import ( "errors" "github.com/LukeHagar/plexgo/internal/utils" + "github.com/LukeHagar/plexgo/retry" + "time" ) var ErrUnsupportedOption = errors.New("unsupported option") @@ -12,12 +14,28 @@ var ErrUnsupportedOption = errors.New("unsupported option") const ( SupportedOptionServerURL = "serverURL" SupportedOptionRetries = "retries" + SupportedOptionTimeout = "timeout" SupportedOptionAcceptHeaderOverride = "acceptHeaderOverride" + SupportedOptionURLOverride = "urlOverride" ) +type AcceptHeaderEnum string + +const ( + AcceptHeaderEnumApplicationJson AcceptHeaderEnum = "application/json" + AcceptHeaderEnumImageJpeg AcceptHeaderEnum = "image/jpeg" +) + +func (e AcceptHeaderEnum) ToPointer() *AcceptHeaderEnum { + return &e +} + type Options struct { - ServerURL *string - Retries *utils.RetryConfig + ServerURL *string + Retries *retry.Config + Timeout *time.Duration + AcceptHeaderOverride *AcceptHeaderEnum + URLOverride *string } type Option func(*Options, ...string) error @@ -51,7 +69,7 @@ func WithTemplatedServerURL(serverURL string, params map[string]string) Option { } // WithRetries allows customizing the default retry configuration. -func WithRetries(config utils.RetryConfig) Option { +func WithRetries(config retry.Config) Option { return func(opts *Options, supportedOptions ...string) error { if !utils.Contains(supportedOptions, SupportedOptionRetries) { return ErrUnsupportedOption @@ -61,3 +79,38 @@ func WithRetries(config utils.RetryConfig) Option { return nil } } + +// WithOperationTimeout allows setting the request timeout applied for an operation. +func WithOperationTimeout(timeout time.Duration) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionRetries) { + return ErrUnsupportedOption + } + + opts.Timeout = &timeout + return nil + } +} + +func WithAcceptHeaderOverride(acceptHeaderOverride AcceptHeaderEnum) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionAcceptHeaderOverride) { + return ErrUnsupportedOption + } + + opts.AcceptHeaderOverride = &acceptHeaderOverride + return nil + } +} + +// WithURLOverride allows overriding the URL. +func WithURLOverride(urlOverride string) Option { + return func(opts *Options, supportedOptions ...string) error { + if !utils.Contains(supportedOptions, SupportedOptionURLOverride) { + return ErrUnsupportedOption + } + + opts.URLOverride = &urlOverride + return nil + } +} diff --git a/models/operations/performsearch.go b/models/operations/performsearch.go index a7eb32f..b0ab93e 100644 --- a/models/operations/performsearch.go +++ b/models/operations/performsearch.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/performvoicesearch.go b/models/operations/performvoicesearch.go index 728d41b..a4f9c63 100644 --- a/models/operations/performvoicesearch.go +++ b/models/operations/performvoicesearch.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/postuserssignindata.go b/models/operations/postuserssignindata.go new file mode 100644 index 0000000..20bca14 --- /dev/null +++ b/models/operations/postuserssignindata.go @@ -0,0 +1,1588 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/LukeHagar/plexgo/internal/utils" + "net/http" + "time" +) + +var PostUsersSignInDataServerList = []string{ + "https://plex.tv/api/v2/", +} + +type PostUsersSignInDataGlobals struct { + // The unique identifier for the client application + // This is used to track the client application and its usage + // (UUID, serial number, or other number unique per device) + // + XPlexClientIdentifier *string `queryParam:"style=form,explode=true,name=X-Plex-Client-Identifier"` +} + +func (o *PostUsersSignInDataGlobals) GetXPlexClientIdentifier() *string { + if o == nil { + return nil + } + return o.XPlexClientIdentifier +} + +// PostUsersSignInDataRequestBody - Login credentials +type PostUsersSignInDataRequestBody struct { + Login string `form:"name=login"` + Password string `form:"name=password"` + RememberMe *bool `default:"false" form:"name=rememberMe"` + VerificationCode *string `form:"name=verificationCode"` +} + +func (p PostUsersSignInDataRequestBody) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PostUsersSignInDataRequestBody) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil +} + +func (o *PostUsersSignInDataRequestBody) GetLogin() string { + if o == nil { + return "" + } + return o.Login +} + +func (o *PostUsersSignInDataRequestBody) GetPassword() string { + if o == nil { + return "" + } + return o.Password +} + +func (o *PostUsersSignInDataRequestBody) GetRememberMe() *bool { + if o == nil { + return nil + } + return o.RememberMe +} + +func (o *PostUsersSignInDataRequestBody) GetVerificationCode() *string { + if o == nil { + return nil + } + return o.VerificationCode +} + +type PostUsersSignInDataRequest struct { + // The unique identifier for the client application + // This is used to track the client application and its usage + // (UUID, serial number, or other number unique per device) + // + XPlexClientIdentifier *string `queryParam:"style=form,explode=true,name=X-Plex-Client-Identifier"` + // Login credentials + RequestBody *PostUsersSignInDataRequestBody `request:"mediaType=application/x-www-form-urlencoded"` +} + +func (o *PostUsersSignInDataRequest) GetXPlexClientIdentifier() *string { + if o == nil { + return nil + } + return o.XPlexClientIdentifier +} + +func (o *PostUsersSignInDataRequest) GetRequestBody() *PostUsersSignInDataRequestBody { + if o == nil { + return nil + } + return o.RequestBody +} + +// PostUsersSignInDataMailingListStatus - Your current mailing list status +type PostUsersSignInDataMailingListStatus string + +const ( + PostUsersSignInDataMailingListStatusActive PostUsersSignInDataMailingListStatus = "active" + PostUsersSignInDataMailingListStatusUnsubscribed PostUsersSignInDataMailingListStatus = "unsubscribed" +) + +func (e PostUsersSignInDataMailingListStatus) ToPointer() *PostUsersSignInDataMailingListStatus { + return &e +} +func (e *PostUsersSignInDataMailingListStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "active": + fallthrough + case "unsubscribed": + *e = PostUsersSignInDataMailingListStatus(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataMailingListStatus: %v", v) + } +} + +// PostUsersSignInDataAutoSelectSubtitle - The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) +type PostUsersSignInDataAutoSelectSubtitle string + +const ( + PostUsersSignInDataAutoSelectSubtitleZero PostUsersSignInDataAutoSelectSubtitle = "0" + PostUsersSignInDataAutoSelectSubtitleOne PostUsersSignInDataAutoSelectSubtitle = "1" +) + +func (e PostUsersSignInDataAutoSelectSubtitle) ToPointer() *PostUsersSignInDataAutoSelectSubtitle { + return &e +} +func (e *PostUsersSignInDataAutoSelectSubtitle) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "0": + fallthrough + case "1": + *e = PostUsersSignInDataAutoSelectSubtitle(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataAutoSelectSubtitle: %v", v) + } +} + +// PostUsersSignInDataDefaultSubtitleAccessibility - The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) +type PostUsersSignInDataDefaultSubtitleAccessibility string + +const ( + PostUsersSignInDataDefaultSubtitleAccessibilityZero PostUsersSignInDataDefaultSubtitleAccessibility = "0" + PostUsersSignInDataDefaultSubtitleAccessibilityOne PostUsersSignInDataDefaultSubtitleAccessibility = "1" +) + +func (e PostUsersSignInDataDefaultSubtitleAccessibility) ToPointer() *PostUsersSignInDataDefaultSubtitleAccessibility { + return &e +} +func (e *PostUsersSignInDataDefaultSubtitleAccessibility) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "0": + fallthrough + case "1": + *e = PostUsersSignInDataDefaultSubtitleAccessibility(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataDefaultSubtitleAccessibility: %v", v) + } +} + +// PostUsersSignInDataDefaultSubtitleForced - The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) +type PostUsersSignInDataDefaultSubtitleForced string + +const ( + PostUsersSignInDataDefaultSubtitleForcedZero PostUsersSignInDataDefaultSubtitleForced = "0" + PostUsersSignInDataDefaultSubtitleForcedOne PostUsersSignInDataDefaultSubtitleForced = "1" +) + +func (e PostUsersSignInDataDefaultSubtitleForced) ToPointer() *PostUsersSignInDataDefaultSubtitleForced { + return &e +} +func (e *PostUsersSignInDataDefaultSubtitleForced) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "0": + fallthrough + case "1": + *e = PostUsersSignInDataDefaultSubtitleForced(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataDefaultSubtitleForced: %v", v) + } +} + +type PostUsersSignInDataWatchedIndicator string + +const ( + PostUsersSignInDataWatchedIndicatorZero PostUsersSignInDataWatchedIndicator = "0" + PostUsersSignInDataWatchedIndicatorOne PostUsersSignInDataWatchedIndicator = "1" +) + +func (e PostUsersSignInDataWatchedIndicator) ToPointer() *PostUsersSignInDataWatchedIndicator { + return &e +} +func (e *PostUsersSignInDataWatchedIndicator) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "0": + fallthrough + case "1": + *e = PostUsersSignInDataWatchedIndicator(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataWatchedIndicator: %v", v) + } +} + +type PostUsersSignInDataMediaReviewsVisibility int64 + +const ( + PostUsersSignInDataMediaReviewsVisibilityZero PostUsersSignInDataMediaReviewsVisibility = 0 + PostUsersSignInDataMediaReviewsVisibilityOne PostUsersSignInDataMediaReviewsVisibility = 1 +) + +func (e PostUsersSignInDataMediaReviewsVisibility) ToPointer() *PostUsersSignInDataMediaReviewsVisibility { + return &e +} +func (e *PostUsersSignInDataMediaReviewsVisibility) UnmarshalJSON(data []byte) error { + var v int64 + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case 0: + fallthrough + case 1: + *e = PostUsersSignInDataMediaReviewsVisibility(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataMediaReviewsVisibility: %v", v) + } +} + +type PostUsersSignInDataUserProfile struct { + // If the account has automatically select audio and subtitle tracks enabled + AutoSelectAudio *bool `default:"true" json:"autoSelectAudio"` + // The preferred audio language for the account + DefaultAudioLanguage *string `json:"defaultAudioLanguage"` + // The preferred subtitle language for the account + DefaultSubtitleLanguage *string `json:"defaultSubtitleLanguage"` + // The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled) + AutoSelectSubtitle *PostUsersSignInDataAutoSelectSubtitle `json:"autoSelectSubtitle,omitempty"` + // The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only shown non-SDH subtitles) + DefaultSubtitleAccessibility *PostUsersSignInDataDefaultSubtitleAccessibility `json:"defaultSubtitleAccessibility,omitempty"` + // The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles) + DefaultSubtitleForced *PostUsersSignInDataDefaultSubtitleForced `json:"defaultSubtitleForced,omitempty"` + WatchedIndicator *PostUsersSignInDataWatchedIndicator `json:"watchedIndicator,omitempty"` + MediaReviewsVisibility *PostUsersSignInDataMediaReviewsVisibility `json:"mediaReviewsVisibility,omitempty"` +} + +func (p PostUsersSignInDataUserProfile) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PostUsersSignInDataUserProfile) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil +} + +func (o *PostUsersSignInDataUserProfile) GetAutoSelectAudio() *bool { + if o == nil { + return nil + } + return o.AutoSelectAudio +} + +func (o *PostUsersSignInDataUserProfile) GetDefaultAudioLanguage() *string { + if o == nil { + return nil + } + return o.DefaultAudioLanguage +} + +func (o *PostUsersSignInDataUserProfile) GetDefaultSubtitleLanguage() *string { + if o == nil { + return nil + } + return o.DefaultSubtitleLanguage +} + +func (o *PostUsersSignInDataUserProfile) GetAutoSelectSubtitle() *PostUsersSignInDataAutoSelectSubtitle { + if o == nil { + return nil + } + return o.AutoSelectSubtitle +} + +func (o *PostUsersSignInDataUserProfile) GetDefaultSubtitleAccessibility() *PostUsersSignInDataDefaultSubtitleAccessibility { + if o == nil { + return nil + } + return o.DefaultSubtitleAccessibility +} + +func (o *PostUsersSignInDataUserProfile) GetDefaultSubtitleForced() *PostUsersSignInDataDefaultSubtitleForced { + if o == nil { + return nil + } + return o.DefaultSubtitleForced +} + +func (o *PostUsersSignInDataUserProfile) GetWatchedIndicator() *PostUsersSignInDataWatchedIndicator { + if o == nil { + return nil + } + return o.WatchedIndicator +} + +func (o *PostUsersSignInDataUserProfile) GetMediaReviewsVisibility() *PostUsersSignInDataMediaReviewsVisibility { + if o == nil { + return nil + } + return o.MediaReviewsVisibility +} + +type PostUsersSignInDataStatus string + +const ( + PostUsersSignInDataStatusOnline PostUsersSignInDataStatus = "online" + PostUsersSignInDataStatusOffline PostUsersSignInDataStatus = "offline" +) + +func (e PostUsersSignInDataStatus) ToPointer() *PostUsersSignInDataStatus { + return &e +} +func (e *PostUsersSignInDataStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "online": + fallthrough + case "offline": + *e = PostUsersSignInDataStatus(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataStatus: %v", v) + } +} + +type PostUsersSignInDataServices struct { + Identifier string `json:"identifier"` + Endpoint string `json:"endpoint"` + Token *string `json:"token"` + Secret *string `json:"secret"` + Status PostUsersSignInDataStatus `json:"status"` +} + +func (o *PostUsersSignInDataServices) GetIdentifier() string { + if o == nil { + return "" + } + return o.Identifier +} + +func (o *PostUsersSignInDataServices) GetEndpoint() string { + if o == nil { + return "" + } + return o.Endpoint +} + +func (o *PostUsersSignInDataServices) GetToken() *string { + if o == nil { + return nil + } + return o.Token +} + +func (o *PostUsersSignInDataServices) GetSecret() *string { + if o == nil { + return nil + } + return o.Secret +} + +func (o *PostUsersSignInDataServices) GetStatus() PostUsersSignInDataStatus { + if o == nil { + return PostUsersSignInDataStatus("") + } + return o.Status +} + +type PostUsersSignInDataFeatures string + +const ( + PostUsersSignInDataFeaturesAndroidDolbyVision PostUsersSignInDataFeatures = "Android - Dolby Vision" + PostUsersSignInDataFeaturesAndroidPiP PostUsersSignInDataFeatures = "Android - PiP" + PostUsersSignInDataFeaturesCuSunset PostUsersSignInDataFeatures = "CU Sunset" + PostUsersSignInDataFeaturesHrkEnableEur PostUsersSignInDataFeatures = "HRK_enable_EUR" + PostUsersSignInDataFeaturesTrebleShowFeatures PostUsersSignInDataFeatures = "TREBLE-show-features" + PostUsersSignInDataFeaturesAdCountdownTimer PostUsersSignInDataFeatures = "ad-countdown-timer" + PostUsersSignInDataFeaturesAdaptiveBitrate PostUsersSignInDataFeatures = "adaptive_bitrate" + PostUsersSignInDataFeaturesAmazonLoopDebug PostUsersSignInDataFeatures = "amazon-loop-debug" + PostUsersSignInDataFeaturesAvodAdAnalysis PostUsersSignInDataFeatures = "avod-ad-analysis" + PostUsersSignInDataFeaturesAvodNewMedia PostUsersSignInDataFeatures = "avod-new-media" + PostUsersSignInDataFeaturesBlacklistGetSignin PostUsersSignInDataFeatures = "blacklist_get_signin" + PostUsersSignInDataFeaturesClientRadioStations PostUsersSignInDataFeatures = "client-radio-stations" + PostUsersSignInDataFeaturesCloudflareTurnstileRequired PostUsersSignInDataFeatures = "cloudflare-turnstile-required" + PostUsersSignInDataFeaturesCollections PostUsersSignInDataFeatures = "collections" + PostUsersSignInDataFeaturesCommentsAndRepliesPushNotifications PostUsersSignInDataFeatures = "comments_and_replies_push_notifications" + PostUsersSignInDataFeaturesCommunityAccessPlexTv PostUsersSignInDataFeatures = "community_access_plex_tv" + PostUsersSignInDataFeaturesCompanionsSonos PostUsersSignInDataFeatures = "companions_sonos" + PostUsersSignInDataFeaturesCustomHomeRemoval PostUsersSignInDataFeatures = "custom-home-removal" + PostUsersSignInDataFeaturesDisableHomeUserFriendships PostUsersSignInDataFeatures = "disable_home_user_friendships" + PostUsersSignInDataFeaturesDisableSharingFriendships PostUsersSignInDataFeatures = "disable_sharing_friendships" + PostUsersSignInDataFeaturesDrmSupport PostUsersSignInDataFeatures = "drm_support" + PostUsersSignInDataFeaturesExcludeRestrictions PostUsersSignInDataFeatures = "exclude restrictions" + PostUsersSignInDataFeaturesFederatedAuth PostUsersSignInDataFeatures = "federated-auth" + PostUsersSignInDataFeaturesFriendRequestPushNotifications PostUsersSignInDataFeatures = "friend_request_push_notifications" + PostUsersSignInDataFeaturesGuidedUpgrade PostUsersSignInDataFeatures = "guided-upgrade" + PostUsersSignInDataFeaturesHome PostUsersSignInDataFeatures = "home" + PostUsersSignInDataFeaturesIncreasePasswordComplexity PostUsersSignInDataFeatures = "increase-password-complexity" + PostUsersSignInDataFeaturesIos14PrivacyBanner PostUsersSignInDataFeatures = "ios14-privacy-banner" + PostUsersSignInDataFeaturesIterableNotificationTokens PostUsersSignInDataFeatures = "iterable-notification-tokens" + PostUsersSignInDataFeaturesKeepPaymentMethod PostUsersSignInDataFeatures = "keep-payment-method" + PostUsersSignInDataFeaturesKevinBacon PostUsersSignInDataFeatures = "kevin-bacon" + PostUsersSignInDataFeaturesKoreaConsent PostUsersSignInDataFeatures = "korea-consent" + PostUsersSignInDataFeaturesLeIsrgRootX1 PostUsersSignInDataFeatures = "le_isrg_root_x1" + PostUsersSignInDataFeaturesLetsEncrypt PostUsersSignInDataFeatures = "lets_encrypt" + PostUsersSignInDataFeaturesLightningDvrPivot PostUsersSignInDataFeatures = "lightning-dvr-pivot" + PostUsersSignInDataFeaturesLiveTvSupportIncompleteSegments PostUsersSignInDataFeatures = "live-tv-support-incomplete-segments" + PostUsersSignInDataFeaturesLivetv PostUsersSignInDataFeatures = "livetv" + PostUsersSignInDataFeaturesMetadataSearch PostUsersSignInDataFeatures = "metadata_search" + PostUsersSignInDataFeaturesNewPlexPassPrices PostUsersSignInDataFeatures = "new_plex_pass_prices" + PostUsersSignInDataFeaturesNewsProviderSunsetModal PostUsersSignInDataFeatures = "news-provider-sunset-modal" + PostUsersSignInDataFeaturesPhotosFavorites PostUsersSignInDataFeatures = "photos-favorites" + PostUsersSignInDataFeaturesPhotosMetadataEdition PostUsersSignInDataFeatures = "photos-metadata-edition" + PostUsersSignInDataFeaturesPmsHealth PostUsersSignInDataFeatures = "pms_health" + PostUsersSignInDataFeaturesRadio PostUsersSignInDataFeatures = "radio" + PostUsersSignInDataFeaturesRateLimitClientToken PostUsersSignInDataFeatures = "rate-limit-client-token" + PostUsersSignInDataFeaturesScrobblingServicePlexTv PostUsersSignInDataFeatures = "scrobbling-service-plex-tv" + PostUsersSignInDataFeaturesSharedServerNotification PostUsersSignInDataFeatures = "shared_server_notification" + PostUsersSignInDataFeaturesSharedSourceNotification PostUsersSignInDataFeatures = "shared_source_notification" + PostUsersSignInDataFeaturesSigninWithApple PostUsersSignInDataFeatures = "signin_with_apple" + PostUsersSignInDataFeaturesSpringServeAdProvider PostUsersSignInDataFeatures = "spring_serve_ad_provider" + PostUsersSignInDataFeaturesTranscoderCache PostUsersSignInDataFeatures = "transcoder_cache" + PostUsersSignInDataFeaturesTunerSharing PostUsersSignInDataFeatures = "tuner-sharing" + PostUsersSignInDataFeaturesTwoFactorAuthentication PostUsersSignInDataFeatures = "two-factor-authentication" + PostUsersSignInDataFeaturesUnsupportedtuners PostUsersSignInDataFeatures = "unsupportedtuners" + PostUsersSignInDataFeaturesUpgrade3ds2 PostUsersSignInDataFeatures = "upgrade-3ds2" + PostUsersSignInDataFeaturesVodSchema PostUsersSignInDataFeatures = "vod-schema" + PostUsersSignInDataFeaturesVodCloudflare PostUsersSignInDataFeatures = "vod_cloudflare" + PostUsersSignInDataFeaturesWatchTogetherInvite PostUsersSignInDataFeatures = "watch-together-invite" + PostUsersSignInDataFeaturesWebServerDashboard PostUsersSignInDataFeatures = "web_server_dashboard" +) + +func (e PostUsersSignInDataFeatures) ToPointer() *PostUsersSignInDataFeatures { + return &e +} +func (e *PostUsersSignInDataFeatures) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Android - Dolby Vision": + fallthrough + case "Android - PiP": + fallthrough + case "CU Sunset": + fallthrough + case "HRK_enable_EUR": + fallthrough + case "TREBLE-show-features": + fallthrough + case "ad-countdown-timer": + fallthrough + case "adaptive_bitrate": + fallthrough + case "amazon-loop-debug": + fallthrough + case "avod-ad-analysis": + fallthrough + case "avod-new-media": + fallthrough + case "blacklist_get_signin": + fallthrough + case "client-radio-stations": + fallthrough + case "cloudflare-turnstile-required": + fallthrough + case "collections": + fallthrough + case "comments_and_replies_push_notifications": + fallthrough + case "community_access_plex_tv": + fallthrough + case "companions_sonos": + fallthrough + case "custom-home-removal": + fallthrough + case "disable_home_user_friendships": + fallthrough + case "disable_sharing_friendships": + fallthrough + case "drm_support": + fallthrough + case "exclude restrictions": + fallthrough + case "federated-auth": + fallthrough + case "friend_request_push_notifications": + fallthrough + case "guided-upgrade": + fallthrough + case "home": + fallthrough + case "increase-password-complexity": + fallthrough + case "ios14-privacy-banner": + fallthrough + case "iterable-notification-tokens": + fallthrough + case "keep-payment-method": + fallthrough + case "kevin-bacon": + fallthrough + case "korea-consent": + fallthrough + case "le_isrg_root_x1": + fallthrough + case "lets_encrypt": + fallthrough + case "lightning-dvr-pivot": + fallthrough + case "live-tv-support-incomplete-segments": + fallthrough + case "livetv": + fallthrough + case "metadata_search": + fallthrough + case "new_plex_pass_prices": + fallthrough + case "news-provider-sunset-modal": + fallthrough + case "photos-favorites": + fallthrough + case "photos-metadata-edition": + fallthrough + case "pms_health": + fallthrough + case "radio": + fallthrough + case "rate-limit-client-token": + fallthrough + case "scrobbling-service-plex-tv": + fallthrough + case "shared_server_notification": + fallthrough + case "shared_source_notification": + fallthrough + case "signin_with_apple": + fallthrough + case "spring_serve_ad_provider": + fallthrough + case "transcoder_cache": + fallthrough + case "tuner-sharing": + fallthrough + case "two-factor-authentication": + fallthrough + case "unsupportedtuners": + fallthrough + case "upgrade-3ds2": + fallthrough + case "vod-schema": + fallthrough + case "vod_cloudflare": + fallthrough + case "watch-together-invite": + fallthrough + case "web_server_dashboard": + *e = PostUsersSignInDataFeatures(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataFeatures: %v", v) + } +} + +// PostUsersSignInDataAuthenticationStatus - String representation of subscriptionActive +type PostUsersSignInDataAuthenticationStatus string + +const ( + PostUsersSignInDataAuthenticationStatusInactive PostUsersSignInDataAuthenticationStatus = "Inactive" + PostUsersSignInDataAuthenticationStatusActive PostUsersSignInDataAuthenticationStatus = "Active" +) + +func (e PostUsersSignInDataAuthenticationStatus) ToPointer() *PostUsersSignInDataAuthenticationStatus { + return &e +} +func (e *PostUsersSignInDataAuthenticationStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Inactive": + fallthrough + case "Active": + *e = PostUsersSignInDataAuthenticationStatus(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataAuthenticationStatus: %v", v) + } +} + +// PostUsersSignInDataSubscription - If the account’s Plex Pass subscription is active +type PostUsersSignInDataSubscription struct { + // List of features allowed on your Plex Pass subscription + Features []PostUsersSignInDataFeatures `json:"features,omitempty"` + // If the account's Plex Pass subscription is active + Active *bool `json:"active,omitempty"` + // Date the account subscribed to Plex Pass + SubscribedAt *string `json:"subscribedAt,omitempty"` + // String representation of subscriptionActive + Status *PostUsersSignInDataAuthenticationStatus `json:"status,omitempty"` + // Payment service used for your Plex Pass subscription + PaymentService *string `json:"paymentService,omitempty"` + // Name of Plex Pass subscription plan + Plan *string `json:"plan,omitempty"` +} + +func (o *PostUsersSignInDataSubscription) GetFeatures() []PostUsersSignInDataFeatures { + if o == nil { + return nil + } + return o.Features +} + +func (o *PostUsersSignInDataSubscription) GetActive() *bool { + if o == nil { + return nil + } + return o.Active +} + +func (o *PostUsersSignInDataSubscription) GetSubscribedAt() *string { + if o == nil { + return nil + } + return o.SubscribedAt +} + +func (o *PostUsersSignInDataSubscription) GetStatus() *PostUsersSignInDataAuthenticationStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *PostUsersSignInDataSubscription) GetPaymentService() *string { + if o == nil { + return nil + } + return o.PaymentService +} + +func (o *PostUsersSignInDataSubscription) GetPlan() *string { + if o == nil { + return nil + } + return o.Plan +} + +type PostUsersSignInDataAuthenticationFeatures string + +const ( + PostUsersSignInDataAuthenticationFeaturesAndroidDolbyVision PostUsersSignInDataAuthenticationFeatures = "Android - Dolby Vision" + PostUsersSignInDataAuthenticationFeaturesAndroidPiP PostUsersSignInDataAuthenticationFeatures = "Android - PiP" + PostUsersSignInDataAuthenticationFeaturesCuSunset PostUsersSignInDataAuthenticationFeatures = "CU Sunset" + PostUsersSignInDataAuthenticationFeaturesHrkEnableEur PostUsersSignInDataAuthenticationFeatures = "HRK_enable_EUR" + PostUsersSignInDataAuthenticationFeaturesTrebleShowFeatures PostUsersSignInDataAuthenticationFeatures = "TREBLE-show-features" + PostUsersSignInDataAuthenticationFeaturesAdCountdownTimer PostUsersSignInDataAuthenticationFeatures = "ad-countdown-timer" + PostUsersSignInDataAuthenticationFeaturesAdaptiveBitrate PostUsersSignInDataAuthenticationFeatures = "adaptive_bitrate" + PostUsersSignInDataAuthenticationFeaturesAmazonLoopDebug PostUsersSignInDataAuthenticationFeatures = "amazon-loop-debug" + PostUsersSignInDataAuthenticationFeaturesAvodAdAnalysis PostUsersSignInDataAuthenticationFeatures = "avod-ad-analysis" + PostUsersSignInDataAuthenticationFeaturesAvodNewMedia PostUsersSignInDataAuthenticationFeatures = "avod-new-media" + PostUsersSignInDataAuthenticationFeaturesBlacklistGetSignin PostUsersSignInDataAuthenticationFeatures = "blacklist_get_signin" + PostUsersSignInDataAuthenticationFeaturesClientRadioStations PostUsersSignInDataAuthenticationFeatures = "client-radio-stations" + PostUsersSignInDataAuthenticationFeaturesCloudflareTurnstileRequired PostUsersSignInDataAuthenticationFeatures = "cloudflare-turnstile-required" + PostUsersSignInDataAuthenticationFeaturesCollections PostUsersSignInDataAuthenticationFeatures = "collections" + PostUsersSignInDataAuthenticationFeaturesCommentsAndRepliesPushNotifications PostUsersSignInDataAuthenticationFeatures = "comments_and_replies_push_notifications" + PostUsersSignInDataAuthenticationFeaturesCommunityAccessPlexTv PostUsersSignInDataAuthenticationFeatures = "community_access_plex_tv" + PostUsersSignInDataAuthenticationFeaturesCompanionsSonos PostUsersSignInDataAuthenticationFeatures = "companions_sonos" + PostUsersSignInDataAuthenticationFeaturesCustomHomeRemoval PostUsersSignInDataAuthenticationFeatures = "custom-home-removal" + PostUsersSignInDataAuthenticationFeaturesDisableHomeUserFriendships PostUsersSignInDataAuthenticationFeatures = "disable_home_user_friendships" + PostUsersSignInDataAuthenticationFeaturesDisableSharingFriendships PostUsersSignInDataAuthenticationFeatures = "disable_sharing_friendships" + PostUsersSignInDataAuthenticationFeaturesDrmSupport PostUsersSignInDataAuthenticationFeatures = "drm_support" + PostUsersSignInDataAuthenticationFeaturesExcludeRestrictions PostUsersSignInDataAuthenticationFeatures = "exclude restrictions" + PostUsersSignInDataAuthenticationFeaturesFederatedAuth PostUsersSignInDataAuthenticationFeatures = "federated-auth" + PostUsersSignInDataAuthenticationFeaturesFriendRequestPushNotifications PostUsersSignInDataAuthenticationFeatures = "friend_request_push_notifications" + PostUsersSignInDataAuthenticationFeaturesGuidedUpgrade PostUsersSignInDataAuthenticationFeatures = "guided-upgrade" + PostUsersSignInDataAuthenticationFeaturesHome PostUsersSignInDataAuthenticationFeatures = "home" + PostUsersSignInDataAuthenticationFeaturesIncreasePasswordComplexity PostUsersSignInDataAuthenticationFeatures = "increase-password-complexity" + PostUsersSignInDataAuthenticationFeaturesIos14PrivacyBanner PostUsersSignInDataAuthenticationFeatures = "ios14-privacy-banner" + PostUsersSignInDataAuthenticationFeaturesIterableNotificationTokens PostUsersSignInDataAuthenticationFeatures = "iterable-notification-tokens" + PostUsersSignInDataAuthenticationFeaturesKeepPaymentMethod PostUsersSignInDataAuthenticationFeatures = "keep-payment-method" + PostUsersSignInDataAuthenticationFeaturesKevinBacon PostUsersSignInDataAuthenticationFeatures = "kevin-bacon" + PostUsersSignInDataAuthenticationFeaturesKoreaConsent PostUsersSignInDataAuthenticationFeatures = "korea-consent" + PostUsersSignInDataAuthenticationFeaturesLeIsrgRootX1 PostUsersSignInDataAuthenticationFeatures = "le_isrg_root_x1" + PostUsersSignInDataAuthenticationFeaturesLetsEncrypt PostUsersSignInDataAuthenticationFeatures = "lets_encrypt" + PostUsersSignInDataAuthenticationFeaturesLightningDvrPivot PostUsersSignInDataAuthenticationFeatures = "lightning-dvr-pivot" + PostUsersSignInDataAuthenticationFeaturesLiveTvSupportIncompleteSegments PostUsersSignInDataAuthenticationFeatures = "live-tv-support-incomplete-segments" + PostUsersSignInDataAuthenticationFeaturesLivetv PostUsersSignInDataAuthenticationFeatures = "livetv" + PostUsersSignInDataAuthenticationFeaturesMetadataSearch PostUsersSignInDataAuthenticationFeatures = "metadata_search" + PostUsersSignInDataAuthenticationFeaturesNewPlexPassPrices PostUsersSignInDataAuthenticationFeatures = "new_plex_pass_prices" + PostUsersSignInDataAuthenticationFeaturesNewsProviderSunsetModal PostUsersSignInDataAuthenticationFeatures = "news-provider-sunset-modal" + PostUsersSignInDataAuthenticationFeaturesPhotosFavorites PostUsersSignInDataAuthenticationFeatures = "photos-favorites" + PostUsersSignInDataAuthenticationFeaturesPhotosMetadataEdition PostUsersSignInDataAuthenticationFeatures = "photos-metadata-edition" + PostUsersSignInDataAuthenticationFeaturesPmsHealth PostUsersSignInDataAuthenticationFeatures = "pms_health" + PostUsersSignInDataAuthenticationFeaturesRadio PostUsersSignInDataAuthenticationFeatures = "radio" + PostUsersSignInDataAuthenticationFeaturesRateLimitClientToken PostUsersSignInDataAuthenticationFeatures = "rate-limit-client-token" + PostUsersSignInDataAuthenticationFeaturesScrobblingServicePlexTv PostUsersSignInDataAuthenticationFeatures = "scrobbling-service-plex-tv" + PostUsersSignInDataAuthenticationFeaturesSharedServerNotification PostUsersSignInDataAuthenticationFeatures = "shared_server_notification" + PostUsersSignInDataAuthenticationFeaturesSharedSourceNotification PostUsersSignInDataAuthenticationFeatures = "shared_source_notification" + PostUsersSignInDataAuthenticationFeaturesSigninWithApple PostUsersSignInDataAuthenticationFeatures = "signin_with_apple" + PostUsersSignInDataAuthenticationFeaturesSpringServeAdProvider PostUsersSignInDataAuthenticationFeatures = "spring_serve_ad_provider" + PostUsersSignInDataAuthenticationFeaturesTranscoderCache PostUsersSignInDataAuthenticationFeatures = "transcoder_cache" + PostUsersSignInDataAuthenticationFeaturesTunerSharing PostUsersSignInDataAuthenticationFeatures = "tuner-sharing" + PostUsersSignInDataAuthenticationFeaturesTwoFactorAuthentication PostUsersSignInDataAuthenticationFeatures = "two-factor-authentication" + PostUsersSignInDataAuthenticationFeaturesUnsupportedtuners PostUsersSignInDataAuthenticationFeatures = "unsupportedtuners" + PostUsersSignInDataAuthenticationFeaturesUpgrade3ds2 PostUsersSignInDataAuthenticationFeatures = "upgrade-3ds2" + PostUsersSignInDataAuthenticationFeaturesVodSchema PostUsersSignInDataAuthenticationFeatures = "vod-schema" + PostUsersSignInDataAuthenticationFeaturesVodCloudflare PostUsersSignInDataAuthenticationFeatures = "vod_cloudflare" + PostUsersSignInDataAuthenticationFeaturesWatchTogetherInvite PostUsersSignInDataAuthenticationFeatures = "watch-together-invite" + PostUsersSignInDataAuthenticationFeaturesWebServerDashboard PostUsersSignInDataAuthenticationFeatures = "web_server_dashboard" +) + +func (e PostUsersSignInDataAuthenticationFeatures) ToPointer() *PostUsersSignInDataAuthenticationFeatures { + return &e +} +func (e *PostUsersSignInDataAuthenticationFeatures) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Android - Dolby Vision": + fallthrough + case "Android - PiP": + fallthrough + case "CU Sunset": + fallthrough + case "HRK_enable_EUR": + fallthrough + case "TREBLE-show-features": + fallthrough + case "ad-countdown-timer": + fallthrough + case "adaptive_bitrate": + fallthrough + case "amazon-loop-debug": + fallthrough + case "avod-ad-analysis": + fallthrough + case "avod-new-media": + fallthrough + case "blacklist_get_signin": + fallthrough + case "client-radio-stations": + fallthrough + case "cloudflare-turnstile-required": + fallthrough + case "collections": + fallthrough + case "comments_and_replies_push_notifications": + fallthrough + case "community_access_plex_tv": + fallthrough + case "companions_sonos": + fallthrough + case "custom-home-removal": + fallthrough + case "disable_home_user_friendships": + fallthrough + case "disable_sharing_friendships": + fallthrough + case "drm_support": + fallthrough + case "exclude restrictions": + fallthrough + case "federated-auth": + fallthrough + case "friend_request_push_notifications": + fallthrough + case "guided-upgrade": + fallthrough + case "home": + fallthrough + case "increase-password-complexity": + fallthrough + case "ios14-privacy-banner": + fallthrough + case "iterable-notification-tokens": + fallthrough + case "keep-payment-method": + fallthrough + case "kevin-bacon": + fallthrough + case "korea-consent": + fallthrough + case "le_isrg_root_x1": + fallthrough + case "lets_encrypt": + fallthrough + case "lightning-dvr-pivot": + fallthrough + case "live-tv-support-incomplete-segments": + fallthrough + case "livetv": + fallthrough + case "metadata_search": + fallthrough + case "new_plex_pass_prices": + fallthrough + case "news-provider-sunset-modal": + fallthrough + case "photos-favorites": + fallthrough + case "photos-metadata-edition": + fallthrough + case "pms_health": + fallthrough + case "radio": + fallthrough + case "rate-limit-client-token": + fallthrough + case "scrobbling-service-plex-tv": + fallthrough + case "shared_server_notification": + fallthrough + case "shared_source_notification": + fallthrough + case "signin_with_apple": + fallthrough + case "spring_serve_ad_provider": + fallthrough + case "transcoder_cache": + fallthrough + case "tuner-sharing": + fallthrough + case "two-factor-authentication": + fallthrough + case "unsupportedtuners": + fallthrough + case "upgrade-3ds2": + fallthrough + case "vod-schema": + fallthrough + case "vod_cloudflare": + fallthrough + case "watch-together-invite": + fallthrough + case "web_server_dashboard": + *e = PostUsersSignInDataAuthenticationFeatures(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataAuthenticationFeatures: %v", v) + } +} + +// PostUsersSignInDataAuthenticationResponseStatus - String representation of subscriptionActive +type PostUsersSignInDataAuthenticationResponseStatus string + +const ( + PostUsersSignInDataAuthenticationResponseStatusInactive PostUsersSignInDataAuthenticationResponseStatus = "Inactive" + PostUsersSignInDataAuthenticationResponseStatusActive PostUsersSignInDataAuthenticationResponseStatus = "Active" +) + +func (e PostUsersSignInDataAuthenticationResponseStatus) ToPointer() *PostUsersSignInDataAuthenticationResponseStatus { + return &e +} +func (e *PostUsersSignInDataAuthenticationResponseStatus) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "Inactive": + fallthrough + case "Active": + *e = PostUsersSignInDataAuthenticationResponseStatus(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataAuthenticationResponseStatus: %v", v) + } +} + +type PostUsersSignInDataAuthenticationSubscription struct { + // List of features allowed on your Plex Pass subscription + Features []PostUsersSignInDataAuthenticationFeatures `json:"features,omitempty"` + // If the account's Plex Pass subscription is active + Active *bool `json:"active,omitempty"` + // Date the account subscribed to Plex Pass + SubscribedAt *string `json:"subscribedAt,omitempty"` + // String representation of subscriptionActive + Status *PostUsersSignInDataAuthenticationResponseStatus `json:"status,omitempty"` + // Payment service used for your Plex Pass subscription + PaymentService *string `json:"paymentService,omitempty"` + // Name of Plex Pass subscription plan + Plan *string `json:"plan,omitempty"` +} + +func (o *PostUsersSignInDataAuthenticationSubscription) GetFeatures() []PostUsersSignInDataAuthenticationFeatures { + if o == nil { + return nil + } + return o.Features +} + +func (o *PostUsersSignInDataAuthenticationSubscription) GetActive() *bool { + if o == nil { + return nil + } + return o.Active +} + +func (o *PostUsersSignInDataAuthenticationSubscription) GetSubscribedAt() *string { + if o == nil { + return nil + } + return o.SubscribedAt +} + +func (o *PostUsersSignInDataAuthenticationSubscription) GetStatus() *PostUsersSignInDataAuthenticationResponseStatus { + if o == nil { + return nil + } + return o.Status +} + +func (o *PostUsersSignInDataAuthenticationSubscription) GetPaymentService() *string { + if o == nil { + return nil + } + return o.PaymentService +} + +func (o *PostUsersSignInDataAuthenticationSubscription) GetPlan() *string { + if o == nil { + return nil + } + return o.Plan +} + +type PostUsersSignInDataState string + +const ( + PostUsersSignInDataStateEnded PostUsersSignInDataState = "ended" +) + +func (e PostUsersSignInDataState) ToPointer() *PostUsersSignInDataState { + return &e +} +func (e *PostUsersSignInDataState) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "ended": + *e = PostUsersSignInDataState(v) + return nil + default: + return fmt.Errorf("invalid value for PostUsersSignInDataState: %v", v) + } +} + +type InternalPaymentMethod struct { +} + +type Billing struct { + InternalPaymentMethod InternalPaymentMethod `json:"internalPaymentMethod"` + PaymentMethodID *int64 `json:"paymentMethodId"` +} + +func (o *Billing) GetInternalPaymentMethod() InternalPaymentMethod { + if o == nil { + return InternalPaymentMethod{} + } + return o.InternalPaymentMethod +} + +func (o *Billing) GetPaymentMethodID() *int64 { + if o == nil { + return nil + } + return o.PaymentMethodID +} + +type PastSubscription struct { + ID *string `json:"id"` + Mode *string `json:"mode"` + RenewsAt *int64 `json:"renewsAt"` + EndsAt *int64 `json:"endsAt"` + Canceled *bool `default:"false" json:"canceled"` + GracePeriod *bool `default:"false" json:"gracePeriod"` + OnHold *bool `default:"false" json:"onHold"` + CanReactivate *bool `default:"false" json:"canReactivate"` + CanUpgrade *bool `default:"false" json:"canUpgrade"` + CanDowngrade *bool `default:"false" json:"canDowngrade"` + CanConvert *bool `default:"false" json:"canConvert"` + Type string `json:"type"` + Transfer *string `json:"transfer"` + State PostUsersSignInDataState `json:"state"` + Billing Billing `json:"billing"` +} + +func (p PastSubscription) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PastSubscription) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil +} + +func (o *PastSubscription) GetID() *string { + if o == nil { + return nil + } + return o.ID +} + +func (o *PastSubscription) GetMode() *string { + if o == nil { + return nil + } + return o.Mode +} + +func (o *PastSubscription) GetRenewsAt() *int64 { + if o == nil { + return nil + } + return o.RenewsAt +} + +func (o *PastSubscription) GetEndsAt() *int64 { + if o == nil { + return nil + } + return o.EndsAt +} + +func (o *PastSubscription) GetCanceled() *bool { + if o == nil { + return nil + } + return o.Canceled +} + +func (o *PastSubscription) GetGracePeriod() *bool { + if o == nil { + return nil + } + return o.GracePeriod +} + +func (o *PastSubscription) GetOnHold() *bool { + if o == nil { + return nil + } + return o.OnHold +} + +func (o *PastSubscription) GetCanReactivate() *bool { + if o == nil { + return nil + } + return o.CanReactivate +} + +func (o *PastSubscription) GetCanUpgrade() *bool { + if o == nil { + return nil + } + return o.CanUpgrade +} + +func (o *PastSubscription) GetCanDowngrade() *bool { + if o == nil { + return nil + } + return o.CanDowngrade +} + +func (o *PastSubscription) GetCanConvert() *bool { + if o == nil { + return nil + } + return o.CanConvert +} + +func (o *PastSubscription) GetType() string { + if o == nil { + return "" + } + return o.Type +} + +func (o *PastSubscription) GetTransfer() *string { + if o == nil { + return nil + } + return o.Transfer +} + +func (o *PastSubscription) GetState() PostUsersSignInDataState { + if o == nil { + return PostUsersSignInDataState("") + } + return o.State +} + +func (o *PastSubscription) GetBilling() Billing { + if o == nil { + return Billing{} + } + return o.Billing +} + +type Trials struct { +} + +// PostUsersSignInDataUserPlexAccount - Returns the user account data with a valid auth token +type PostUsersSignInDataUserPlexAccount struct { + // Unknown + AdsConsent *bool `json:"adsConsent"` + // Unknown + AdsConsentReminderAt *time.Time `json:"adsConsentReminderAt"` + // Unknown + AdsConsentSetAt *time.Time `json:"adsConsentSetAt"` + // Unknown + Anonymous *bool `default:"false" json:"anonymous"` + // The account token + AuthToken string `json:"authToken"` + // If the two-factor authentication backup codes have been created + BackupCodesCreated *bool `default:"false" json:"backupCodesCreated"` + // If the account has been confirmed + Confirmed *bool `default:"false" json:"confirmed"` + // The account country + Country string `json:"country"` + // The account email address + Email string `json:"email"` + // If login with email only is enabled + EmailOnlyAuth *bool `default:"false" json:"emailOnlyAuth"` + // If experimental features are enabled + ExperimentalFeatures *bool `default:"false" json:"experimentalFeatures"` + // Your account full name + FriendlyName string `json:"friendlyName"` + // List of devices your allowed to use with this account + Entitlements []string `json:"entitlements"` + // If the account is a Plex Home guest user + Guest *bool `default:"false" json:"guest"` + // If the account has a password + HasPassword *bool `default:"true" json:"hasPassword"` + // If the account is a Plex Home user + Home *bool `default:"false" json:"home"` + // If the account is the Plex Home admin + HomeAdmin *bool `default:"false" json:"homeAdmin"` + // The number of accounts in the Plex Home + HomeSize int `json:"homeSize"` + // The Plex account ID + ID int `json:"id"` + // Unix epoch datetime + JoinedAt int64 `json:"joinedAt"` + // The account locale + Locale *string `json:"locale"` + // If you are subscribed to the Plex newsletter + MailingListActive *bool `default:"false" json:"mailingListActive"` + // Your current mailing list status + MailingListStatus PostUsersSignInDataMailingListStatus `json:"mailingListStatus"` + // The maximum number of accounts allowed in the Plex Home + MaxHomeSize int `json:"maxHomeSize"` + // [Might be removed] The hashed Plex Home PIN + // + // Deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + Pin *string `json:"pin,omitempty"` + Profile PostUsersSignInDataUserProfile `json:"profile"` + // If the account has a Plex Home PIN enabled + Protected *bool `default:"false" json:"protected"` + // Unix epoch datetime + RememberExpiresAt int64 `json:"rememberExpiresAt"` + // If the account is a Plex Home managed user + Restricted *bool `default:"false" json:"restricted"` + // [Might be removed] List of account roles. Plexpass membership listed here + Roles []string `json:"roles,omitempty"` + // Unknown + ScrobbleTypes string `json:"scrobbleTypes"` + Services []PostUsersSignInDataServices `json:"services"` + // If the account’s Plex Pass subscription is active + Subscription PostUsersSignInDataSubscription `json:"subscription"` + // Description of the Plex Pass subscription + SubscriptionDescription *string `json:"subscriptionDescription"` + Subscriptions []PostUsersSignInDataAuthenticationSubscription `json:"subscriptions"` + // URL of the account thumbnail + Thumb string `json:"thumb"` + // The title of the account (username or friendly name) + Title string `json:"title"` + // If two-factor authentication is enabled + TwoFactorEnabled *bool `default:"false" json:"twoFactorEnabled"` + // The account username + Username string `json:"username"` + // The account UUID + UUID string `json:"uuid"` + PastSubscriptions []PastSubscription `json:"pastSubscriptions"` + Trials []Trials `json:"trials"` +} + +func (p PostUsersSignInDataUserPlexAccount) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(p, "", false) +} + +func (p *PostUsersSignInDataUserPlexAccount) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { + return err + } + return nil +} + +func (o *PostUsersSignInDataUserPlexAccount) GetAdsConsent() *bool { + if o == nil { + return nil + } + return o.AdsConsent +} + +func (o *PostUsersSignInDataUserPlexAccount) GetAdsConsentReminderAt() *time.Time { + if o == nil { + return nil + } + return o.AdsConsentReminderAt +} + +func (o *PostUsersSignInDataUserPlexAccount) GetAdsConsentSetAt() *time.Time { + if o == nil { + return nil + } + return o.AdsConsentSetAt +} + +func (o *PostUsersSignInDataUserPlexAccount) GetAnonymous() *bool { + if o == nil { + return nil + } + return o.Anonymous +} + +func (o *PostUsersSignInDataUserPlexAccount) GetAuthToken() string { + if o == nil { + return "" + } + return o.AuthToken +} + +func (o *PostUsersSignInDataUserPlexAccount) GetBackupCodesCreated() *bool { + if o == nil { + return nil + } + return o.BackupCodesCreated +} + +func (o *PostUsersSignInDataUserPlexAccount) GetConfirmed() *bool { + if o == nil { + return nil + } + return o.Confirmed +} + +func (o *PostUsersSignInDataUserPlexAccount) GetCountry() string { + if o == nil { + return "" + } + return o.Country +} + +func (o *PostUsersSignInDataUserPlexAccount) GetEmail() string { + if o == nil { + return "" + } + return o.Email +} + +func (o *PostUsersSignInDataUserPlexAccount) GetEmailOnlyAuth() *bool { + if o == nil { + return nil + } + return o.EmailOnlyAuth +} + +func (o *PostUsersSignInDataUserPlexAccount) GetExperimentalFeatures() *bool { + if o == nil { + return nil + } + return o.ExperimentalFeatures +} + +func (o *PostUsersSignInDataUserPlexAccount) GetFriendlyName() string { + if o == nil { + return "" + } + return o.FriendlyName +} + +func (o *PostUsersSignInDataUserPlexAccount) GetEntitlements() []string { + if o == nil { + return []string{} + } + return o.Entitlements +} + +func (o *PostUsersSignInDataUserPlexAccount) GetGuest() *bool { + if o == nil { + return nil + } + return o.Guest +} + +func (o *PostUsersSignInDataUserPlexAccount) GetHasPassword() *bool { + if o == nil { + return nil + } + return o.HasPassword +} + +func (o *PostUsersSignInDataUserPlexAccount) GetHome() *bool { + if o == nil { + return nil + } + return o.Home +} + +func (o *PostUsersSignInDataUserPlexAccount) GetHomeAdmin() *bool { + if o == nil { + return nil + } + return o.HomeAdmin +} + +func (o *PostUsersSignInDataUserPlexAccount) GetHomeSize() int { + if o == nil { + return 0 + } + return o.HomeSize +} + +func (o *PostUsersSignInDataUserPlexAccount) GetID() int { + if o == nil { + return 0 + } + return o.ID +} + +func (o *PostUsersSignInDataUserPlexAccount) GetJoinedAt() int64 { + if o == nil { + return 0 + } + return o.JoinedAt +} + +func (o *PostUsersSignInDataUserPlexAccount) GetLocale() *string { + if o == nil { + return nil + } + return o.Locale +} + +func (o *PostUsersSignInDataUserPlexAccount) GetMailingListActive() *bool { + if o == nil { + return nil + } + return o.MailingListActive +} + +func (o *PostUsersSignInDataUserPlexAccount) GetMailingListStatus() PostUsersSignInDataMailingListStatus { + if o == nil { + return PostUsersSignInDataMailingListStatus("") + } + return o.MailingListStatus +} + +func (o *PostUsersSignInDataUserPlexAccount) GetMaxHomeSize() int { + if o == nil { + return 0 + } + return o.MaxHomeSize +} + +func (o *PostUsersSignInDataUserPlexAccount) GetPin() *string { + if o == nil { + return nil + } + return o.Pin +} + +func (o *PostUsersSignInDataUserPlexAccount) GetProfile() PostUsersSignInDataUserProfile { + if o == nil { + return PostUsersSignInDataUserProfile{} + } + return o.Profile +} + +func (o *PostUsersSignInDataUserPlexAccount) GetProtected() *bool { + if o == nil { + return nil + } + return o.Protected +} + +func (o *PostUsersSignInDataUserPlexAccount) GetRememberExpiresAt() int64 { + if o == nil { + return 0 + } + return o.RememberExpiresAt +} + +func (o *PostUsersSignInDataUserPlexAccount) GetRestricted() *bool { + if o == nil { + return nil + } + return o.Restricted +} + +func (o *PostUsersSignInDataUserPlexAccount) GetRoles() []string { + if o == nil { + return nil + } + return o.Roles +} + +func (o *PostUsersSignInDataUserPlexAccount) GetScrobbleTypes() string { + if o == nil { + return "" + } + return o.ScrobbleTypes +} + +func (o *PostUsersSignInDataUserPlexAccount) GetServices() []PostUsersSignInDataServices { + if o == nil { + return []PostUsersSignInDataServices{} + } + return o.Services +} + +func (o *PostUsersSignInDataUserPlexAccount) GetSubscription() PostUsersSignInDataSubscription { + if o == nil { + return PostUsersSignInDataSubscription{} + } + return o.Subscription +} + +func (o *PostUsersSignInDataUserPlexAccount) GetSubscriptionDescription() *string { + if o == nil { + return nil + } + return o.SubscriptionDescription +} + +func (o *PostUsersSignInDataUserPlexAccount) GetSubscriptions() []PostUsersSignInDataAuthenticationSubscription { + if o == nil { + return []PostUsersSignInDataAuthenticationSubscription{} + } + return o.Subscriptions +} + +func (o *PostUsersSignInDataUserPlexAccount) GetThumb() string { + if o == nil { + return "" + } + return o.Thumb +} + +func (o *PostUsersSignInDataUserPlexAccount) GetTitle() string { + if o == nil { + return "" + } + return o.Title +} + +func (o *PostUsersSignInDataUserPlexAccount) GetTwoFactorEnabled() *bool { + if o == nil { + return nil + } + return o.TwoFactorEnabled +} + +func (o *PostUsersSignInDataUserPlexAccount) GetUsername() string { + if o == nil { + return "" + } + return o.Username +} + +func (o *PostUsersSignInDataUserPlexAccount) GetUUID() string { + if o == nil { + return "" + } + return o.UUID +} + +func (o *PostUsersSignInDataUserPlexAccount) GetPastSubscriptions() []PastSubscription { + if o == nil { + return []PastSubscription{} + } + return o.PastSubscriptions +} + +func (o *PostUsersSignInDataUserPlexAccount) GetTrials() []Trials { + if o == nil { + return []Trials{} + } + return o.Trials +} + +type PostUsersSignInDataResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Returns the user account data with a valid auth token + UserPlexAccount *PostUsersSignInDataUserPlexAccount +} + +func (o *PostUsersSignInDataResponse) GetContentType() string { + if o == nil { + return "" + } + return o.ContentType +} + +func (o *PostUsersSignInDataResponse) GetStatusCode() int { + if o == nil { + return 0 + } + return o.StatusCode +} + +func (o *PostUsersSignInDataResponse) GetRawResponse() *http.Response { + if o == nil { + return nil + } + return o.RawResponse +} + +func (o *PostUsersSignInDataResponse) GetUserPlexAccount() *PostUsersSignInDataUserPlexAccount { + if o == nil { + return nil + } + return o.UserPlexAccount +} diff --git a/models/operations/refreshlibrary.go b/models/operations/refreshlibrary.go deleted file mode 100644 index 34c65c7..0000000 --- a/models/operations/refreshlibrary.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package operations - -import ( - "net/http" -) - -type RefreshLibraryRequest struct { - // the Id of the library to refresh - SectionID float64 `pathParam:"style=simple,explode=false,name=sectionId"` -} - -func (o *RefreshLibraryRequest) GetSectionID() float64 { - if o == nil { - return 0.0 - } - return o.SectionID -} - -type RefreshLibraryResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response -} - -func (o *RefreshLibraryResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *RefreshLibraryResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *RefreshLibraryResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} diff --git a/models/operations/searchlibrary.go b/models/operations/searchlibrary.go deleted file mode 100644 index 246104f..0000000 --- a/models/operations/searchlibrary.go +++ /dev/null @@ -1,384 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package operations - -import ( - "encoding/json" - "fmt" - "net/http" -) - -// Type - Plex content type to search for -type Type int64 - -const ( - TypeOne Type = 1 - TypeTwo Type = 2 - TypeThree Type = 3 - TypeFour Type = 4 -) - -func (e Type) ToPointer() *Type { - return &e -} -func (e *Type) UnmarshalJSON(data []byte) error { - var v int64 - if err := json.Unmarshal(data, &v); err != nil { - return err - } - switch v { - case 1: - fallthrough - case 2: - fallthrough - case 3: - fallthrough - case 4: - *e = Type(v) - return nil - default: - return fmt.Errorf("invalid value for Type: %v", v) - } -} - -type SearchLibraryRequest struct { - // the Id of the library to query - SectionID int64 `pathParam:"style=simple,explode=false,name=sectionId"` - // Plex content type to search for - Type Type `queryParam:"style=form,explode=true,name=type"` -} - -func (o *SearchLibraryRequest) GetSectionID() int64 { - if o == nil { - return 0 - } - return o.SectionID -} - -func (o *SearchLibraryRequest) GetType() Type { - if o == nil { - return Type(0) - } - return o.Type -} - -type SearchLibraryMetadata struct { - RatingKey *string `json:"ratingKey,omitempty"` - Key *string `json:"key,omitempty"` - ParentRatingKey *string `json:"parentRatingKey,omitempty"` - GUID *string `json:"guid,omitempty"` - ParentGUID *string `json:"parentGuid,omitempty"` - ParentStudio *string `json:"parentStudio,omitempty"` - Type *string `json:"type,omitempty"` - Title *string `json:"title,omitempty"` - ParentKey *string `json:"parentKey,omitempty"` - ParentTitle *string `json:"parentTitle,omitempty"` - Summary *string `json:"summary,omitempty"` - Index *int `json:"index,omitempty"` - ParentIndex *int `json:"parentIndex,omitempty"` - ParentYear *int `json:"parentYear,omitempty"` - Thumb *string `json:"thumb,omitempty"` - Art *string `json:"art,omitempty"` - ParentThumb *string `json:"parentThumb,omitempty"` - ParentTheme *string `json:"parentTheme,omitempty"` - AddedAt *int `json:"addedAt,omitempty"` - UpdatedAt *int `json:"updatedAt,omitempty"` -} - -func (o *SearchLibraryMetadata) GetRatingKey() *string { - if o == nil { - return nil - } - return o.RatingKey -} - -func (o *SearchLibraryMetadata) GetKey() *string { - if o == nil { - return nil - } - return o.Key -} - -func (o *SearchLibraryMetadata) GetParentRatingKey() *string { - if o == nil { - return nil - } - return o.ParentRatingKey -} - -func (o *SearchLibraryMetadata) GetGUID() *string { - if o == nil { - return nil - } - return o.GUID -} - -func (o *SearchLibraryMetadata) GetParentGUID() *string { - if o == nil { - return nil - } - return o.ParentGUID -} - -func (o *SearchLibraryMetadata) GetParentStudio() *string { - if o == nil { - return nil - } - return o.ParentStudio -} - -func (o *SearchLibraryMetadata) GetType() *string { - if o == nil { - return nil - } - return o.Type -} - -func (o *SearchLibraryMetadata) GetTitle() *string { - if o == nil { - return nil - } - return o.Title -} - -func (o *SearchLibraryMetadata) GetParentKey() *string { - if o == nil { - return nil - } - return o.ParentKey -} - -func (o *SearchLibraryMetadata) GetParentTitle() *string { - if o == nil { - return nil - } - return o.ParentTitle -} - -func (o *SearchLibraryMetadata) GetSummary() *string { - if o == nil { - return nil - } - return o.Summary -} - -func (o *SearchLibraryMetadata) GetIndex() *int { - if o == nil { - return nil - } - return o.Index -} - -func (o *SearchLibraryMetadata) GetParentIndex() *int { - if o == nil { - return nil - } - return o.ParentIndex -} - -func (o *SearchLibraryMetadata) GetParentYear() *int { - if o == nil { - return nil - } - return o.ParentYear -} - -func (o *SearchLibraryMetadata) GetThumb() *string { - if o == nil { - return nil - } - return o.Thumb -} - -func (o *SearchLibraryMetadata) GetArt() *string { - if o == nil { - return nil - } - return o.Art -} - -func (o *SearchLibraryMetadata) GetParentThumb() *string { - if o == nil { - return nil - } - return o.ParentThumb -} - -func (o *SearchLibraryMetadata) GetParentTheme() *string { - if o == nil { - return nil - } - return o.ParentTheme -} - -func (o *SearchLibraryMetadata) GetAddedAt() *int { - if o == nil { - return nil - } - return o.AddedAt -} - -func (o *SearchLibraryMetadata) GetUpdatedAt() *int { - if o == nil { - return nil - } - return o.UpdatedAt -} - -type SearchLibraryMediaContainer struct { - Size *int `json:"size,omitempty"` - AllowSync *bool `json:"allowSync,omitempty"` - Art *string `json:"art,omitempty"` - Identifier *string `json:"identifier,omitempty"` - MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"` - MediaTagVersion *int `json:"mediaTagVersion,omitempty"` - Nocache *bool `json:"nocache,omitempty"` - Thumb *string `json:"thumb,omitempty"` - Title1 *string `json:"title1,omitempty"` - Title2 *string `json:"title2,omitempty"` - ViewGroup *string `json:"viewGroup,omitempty"` - ViewMode *int `json:"viewMode,omitempty"` - Metadata []SearchLibraryMetadata `json:"Metadata,omitempty"` -} - -func (o *SearchLibraryMediaContainer) GetSize() *int { - if o == nil { - return nil - } - return o.Size -} - -func (o *SearchLibraryMediaContainer) GetAllowSync() *bool { - if o == nil { - return nil - } - return o.AllowSync -} - -func (o *SearchLibraryMediaContainer) GetArt() *string { - if o == nil { - return nil - } - return o.Art -} - -func (o *SearchLibraryMediaContainer) GetIdentifier() *string { - if o == nil { - return nil - } - return o.Identifier -} - -func (o *SearchLibraryMediaContainer) GetMediaTagPrefix() *string { - if o == nil { - return nil - } - return o.MediaTagPrefix -} - -func (o *SearchLibraryMediaContainer) GetMediaTagVersion() *int { - if o == nil { - return nil - } - return o.MediaTagVersion -} - -func (o *SearchLibraryMediaContainer) GetNocache() *bool { - if o == nil { - return nil - } - return o.Nocache -} - -func (o *SearchLibraryMediaContainer) GetThumb() *string { - if o == nil { - return nil - } - return o.Thumb -} - -func (o *SearchLibraryMediaContainer) GetTitle1() *string { - if o == nil { - return nil - } - return o.Title1 -} - -func (o *SearchLibraryMediaContainer) GetTitle2() *string { - if o == nil { - return nil - } - return o.Title2 -} - -func (o *SearchLibraryMediaContainer) GetViewGroup() *string { - if o == nil { - return nil - } - return o.ViewGroup -} - -func (o *SearchLibraryMediaContainer) GetViewMode() *int { - if o == nil { - return nil - } - return o.ViewMode -} - -func (o *SearchLibraryMediaContainer) GetMetadata() []SearchLibraryMetadata { - if o == nil { - return nil - } - return o.Metadata -} - -// SearchLibraryResponseBody - The contents of the library by section and type -type SearchLibraryResponseBody struct { - MediaContainer *SearchLibraryMediaContainer `json:"MediaContainer,omitempty"` -} - -func (o *SearchLibraryResponseBody) GetMediaContainer() *SearchLibraryMediaContainer { - if o == nil { - return nil - } - return o.MediaContainer -} - -type SearchLibraryResponse struct { - // HTTP response content type for this operation - ContentType string - // HTTP response status code for this operation - StatusCode int - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response - // The contents of the library by section and type - Object *SearchLibraryResponseBody -} - -func (o *SearchLibraryResponse) GetContentType() string { - if o == nil { - return "" - } - return o.ContentType -} - -func (o *SearchLibraryResponse) GetStatusCode() int { - if o == nil { - return 0 - } - return o.StatusCode -} - -func (o *SearchLibraryResponse) GetRawResponse() *http.Response { - if o == nil { - return nil - } - return o.RawResponse -} - -func (o *SearchLibraryResponse) GetObject() *SearchLibraryResponseBody { - if o == nil { - return nil - } - return o.Object -} diff --git a/models/operations/startalltasks.go b/models/operations/startalltasks.go index a293a11..0be4513 100644 --- a/models/operations/startalltasks.go +++ b/models/operations/startalltasks.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/starttask.go b/models/operations/starttask.go index 9370014..e6993ff 100644 --- a/models/operations/starttask.go +++ b/models/operations/starttask.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/startuniversaltranscode.go b/models/operations/startuniversaltranscode.go index 74c1770..d0ccec4 100644 --- a/models/operations/startuniversaltranscode.go +++ b/models/operations/startuniversaltranscode.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/stopalltasks.go b/models/operations/stopalltasks.go index e66f13d..0f42e0d 100644 --- a/models/operations/stopalltasks.go +++ b/models/operations/stopalltasks.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/stoptask.go b/models/operations/stoptask.go index 13e204b..72de16f 100644 --- a/models/operations/stoptask.go +++ b/models/operations/stoptask.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/stoptranscodesession.go b/models/operations/stoptranscodesession.go index e7db5be..5490b70 100644 --- a/models/operations/stoptranscodesession.go +++ b/models/operations/stoptranscodesession.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/updateplaylist.go b/models/operations/updateplaylist.go index ee9dbc6..8c73f0e 100644 --- a/models/operations/updateplaylist.go +++ b/models/operations/updateplaylist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/updateplayprogress.go b/models/operations/updateplayprogress.go index de27407..9c653e5 100644 --- a/models/operations/updateplayprogress.go +++ b/models/operations/updateplayprogress.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations diff --git a/models/operations/uploadplaylist.go b/models/operations/uploadplaylist.go index 38b3674..c0822bf 100644 --- a/models/operations/uploadplaylist.go +++ b/models/operations/uploadplaylist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package operations @@ -8,21 +8,21 @@ import ( "net/http" ) -// Force overwriting of duplicate playlists. +// QueryParamForce - Force overwriting of duplicate playlists. // By default, a playlist file uploaded with the same path will overwrite the existing playlist. // The `force` argument is used to disable overwriting. // If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded. -type Force int64 +type QueryParamForce int64 const ( - ForceZero Force = 0 - ForceOne Force = 1 + QueryParamForceZero QueryParamForce = 0 + QueryParamForceOne QueryParamForce = 1 ) -func (e Force) ToPointer() *Force { +func (e QueryParamForce) ToPointer() *QueryParamForce { return &e } -func (e *Force) UnmarshalJSON(data []byte) error { +func (e *QueryParamForce) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { return err @@ -31,10 +31,10 @@ func (e *Force) UnmarshalJSON(data []byte) error { case 0: fallthrough case 1: - *e = Force(v) + *e = QueryParamForce(v) return nil default: - return fmt.Errorf("invalid value for Force: %v", v) + return fmt.Errorf("invalid value for QueryParamForce: %v", v) } } @@ -52,7 +52,7 @@ type UploadPlaylistRequest struct { // The `force` argument is used to disable overwriting. // If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded. // - Force Force `queryParam:"style=form,explode=true,name=force"` + Force QueryParamForce `queryParam:"style=form,explode=true,name=force"` } func (o *UploadPlaylistRequest) GetPath() string { @@ -62,9 +62,9 @@ func (o *UploadPlaylistRequest) GetPath() string { return o.Path } -func (o *UploadPlaylistRequest) GetForce() Force { +func (o *UploadPlaylistRequest) GetForce() QueryParamForce { if o == nil { - return Force(0) + return QueryParamForce(0) } return o.Force } diff --git a/models/sdkerrors/addplaylistcontents.go b/models/sdkerrors/addplaylistcontents.go index 691e12e..50e7a30 100644 --- a/models/sdkerrors/addplaylistcontents.go +++ b/models/sdkerrors/addplaylistcontents.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type AddPlaylistContentsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type AddPlaylistContentsPlaylistsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *AddPlaylistContentsErrors) GetCode() *float64 { +func (o *AddPlaylistContentsPlaylistsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *AddPlaylistContentsPlaylistsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *AddPlaylistContentsPlaylistsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// AddPlaylistContentsPlaylistsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type AddPlaylistContentsPlaylistsResponseBody struct { + Errors []AddPlaylistContentsPlaylistsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &AddPlaylistContentsPlaylistsResponseBody{} + +func (e *AddPlaylistContentsPlaylistsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type AddPlaylistContentsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *AddPlaylistContentsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *AddPlaylistContentsErrors) GetMessage() *string { return o.Message } -func (o *AddPlaylistContentsErrors) GetStatus() *float64 { +func (o *AddPlaylistContentsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// AddPlaylistContentsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// AddPlaylistContentsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type AddPlaylistContentsResponseBody struct { Errors []AddPlaylistContentsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/applyupdates.go b/models/sdkerrors/applyupdates.go index db09296..19374fc 100644 --- a/models/sdkerrors/applyupdates.go +++ b/models/sdkerrors/applyupdates.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type ApplyUpdatesErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type ApplyUpdatesUpdaterErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *ApplyUpdatesErrors) GetCode() *float64 { +func (o *ApplyUpdatesUpdaterErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *ApplyUpdatesUpdaterErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *ApplyUpdatesUpdaterErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// ApplyUpdatesUpdaterResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type ApplyUpdatesUpdaterResponseBody struct { + Errors []ApplyUpdatesUpdaterErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &ApplyUpdatesUpdaterResponseBody{} + +func (e *ApplyUpdatesUpdaterResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type ApplyUpdatesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *ApplyUpdatesErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *ApplyUpdatesErrors) GetMessage() *string { return o.Message } -func (o *ApplyUpdatesErrors) GetStatus() *float64 { +func (o *ApplyUpdatesErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// ApplyUpdatesResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// ApplyUpdatesResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type ApplyUpdatesResponseBody struct { Errors []ApplyUpdatesErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/cancelserveractivities.go b/models/sdkerrors/cancelserveractivities.go index 7e460c4..3b293de 100644 --- a/models/sdkerrors/cancelserveractivities.go +++ b/models/sdkerrors/cancelserveractivities.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type CancelServerActivitiesErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type CancelServerActivitiesActivitiesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *CancelServerActivitiesErrors) GetCode() *float64 { +func (o *CancelServerActivitiesActivitiesErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *CancelServerActivitiesActivitiesErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *CancelServerActivitiesActivitiesErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// CancelServerActivitiesActivitiesResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type CancelServerActivitiesActivitiesResponseBody struct { + Errors []CancelServerActivitiesActivitiesErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &CancelServerActivitiesActivitiesResponseBody{} + +func (e *CancelServerActivitiesActivitiesResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type CancelServerActivitiesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *CancelServerActivitiesErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *CancelServerActivitiesErrors) GetMessage() *string { return o.Message } -func (o *CancelServerActivitiesErrors) GetStatus() *float64 { +func (o *CancelServerActivitiesErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// CancelServerActivitiesResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// CancelServerActivitiesResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type CancelServerActivitiesResponseBody struct { Errors []CancelServerActivitiesErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/checkforupdates.go b/models/sdkerrors/checkforupdates.go index ab829a6..20b9b67 100644 --- a/models/sdkerrors/checkforupdates.go +++ b/models/sdkerrors/checkforupdates.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type CheckForUpdatesErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type CheckForUpdatesUpdaterErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *CheckForUpdatesErrors) GetCode() *float64 { +func (o *CheckForUpdatesUpdaterErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *CheckForUpdatesUpdaterErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *CheckForUpdatesUpdaterErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// CheckForUpdatesUpdaterResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type CheckForUpdatesUpdaterResponseBody struct { + Errors []CheckForUpdatesUpdaterErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &CheckForUpdatesUpdaterResponseBody{} + +func (e *CheckForUpdatesUpdaterResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type CheckForUpdatesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *CheckForUpdatesErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *CheckForUpdatesErrors) GetMessage() *string { return o.Message } -func (o *CheckForUpdatesErrors) GetStatus() *float64 { +func (o *CheckForUpdatesErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// CheckForUpdatesResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// CheckForUpdatesResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type CheckForUpdatesResponseBody struct { Errors []CheckForUpdatesErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/clearplaylistcontents.go b/models/sdkerrors/clearplaylistcontents.go index e8a2888..cd7f80e 100644 --- a/models/sdkerrors/clearplaylistcontents.go +++ b/models/sdkerrors/clearplaylistcontents.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type ClearPlaylistContentsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type ClearPlaylistContentsPlaylistsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *ClearPlaylistContentsErrors) GetCode() *float64 { +func (o *ClearPlaylistContentsPlaylistsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *ClearPlaylistContentsPlaylistsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *ClearPlaylistContentsPlaylistsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// ClearPlaylistContentsPlaylistsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type ClearPlaylistContentsPlaylistsResponseBody struct { + Errors []ClearPlaylistContentsPlaylistsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &ClearPlaylistContentsPlaylistsResponseBody{} + +func (e *ClearPlaylistContentsPlaylistsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type ClearPlaylistContentsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *ClearPlaylistContentsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *ClearPlaylistContentsErrors) GetMessage() *string { return o.Message } -func (o *ClearPlaylistContentsErrors) GetStatus() *float64 { +func (o *ClearPlaylistContentsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// ClearPlaylistContentsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// ClearPlaylistContentsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type ClearPlaylistContentsResponseBody struct { Errors []ClearPlaylistContentsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/createplaylist.go b/models/sdkerrors/createplaylist.go index fa642f4..3603629 100644 --- a/models/sdkerrors/createplaylist.go +++ b/models/sdkerrors/createplaylist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type CreatePlaylistErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type CreatePlaylistPlaylistsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *CreatePlaylistErrors) GetCode() *float64 { +func (o *CreatePlaylistPlaylistsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *CreatePlaylistPlaylistsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *CreatePlaylistPlaylistsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// CreatePlaylistPlaylistsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type CreatePlaylistPlaylistsResponseBody struct { + Errors []CreatePlaylistPlaylistsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &CreatePlaylistPlaylistsResponseBody{} + +func (e *CreatePlaylistPlaylistsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type CreatePlaylistErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *CreatePlaylistErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *CreatePlaylistErrors) GetMessage() *string { return o.Message } -func (o *CreatePlaylistErrors) GetStatus() *float64 { +func (o *CreatePlaylistErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// CreatePlaylistResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// CreatePlaylistResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type CreatePlaylistResponseBody struct { Errors []CreatePlaylistErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/deletelibrary.go b/models/sdkerrors/deletelibrary.go index f404dab..1a8fa3b 100644 --- a/models/sdkerrors/deletelibrary.go +++ b/models/sdkerrors/deletelibrary.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type DeleteLibraryErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type DeleteLibraryLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *DeleteLibraryErrors) GetCode() *float64 { +func (o *DeleteLibraryLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *DeleteLibraryLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *DeleteLibraryLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// DeleteLibraryLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type DeleteLibraryLibraryResponseBody struct { + Errors []DeleteLibraryLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &DeleteLibraryLibraryResponseBody{} + +func (e *DeleteLibraryLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type DeleteLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *DeleteLibraryErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *DeleteLibraryErrors) GetMessage() *string { return o.Message } -func (o *DeleteLibraryErrors) GetStatus() *float64 { +func (o *DeleteLibraryErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// DeleteLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// DeleteLibraryResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type DeleteLibraryResponseBody struct { Errors []DeleteLibraryErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/deleteplaylist.go b/models/sdkerrors/deleteplaylist.go index 74061e3..88885a1 100644 --- a/models/sdkerrors/deleteplaylist.go +++ b/models/sdkerrors/deleteplaylist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type DeletePlaylistErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type DeletePlaylistPlaylistsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *DeletePlaylistErrors) GetCode() *float64 { +func (o *DeletePlaylistPlaylistsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *DeletePlaylistPlaylistsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *DeletePlaylistPlaylistsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// DeletePlaylistPlaylistsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type DeletePlaylistPlaylistsResponseBody struct { + Errors []DeletePlaylistPlaylistsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &DeletePlaylistPlaylistsResponseBody{} + +func (e *DeletePlaylistPlaylistsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type DeletePlaylistErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *DeletePlaylistErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *DeletePlaylistErrors) GetMessage() *string { return o.Message } -func (o *DeletePlaylistErrors) GetStatus() *float64 { +func (o *DeletePlaylistErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// DeletePlaylistResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// DeletePlaylistResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type DeletePlaylistResponseBody struct { Errors []DeletePlaylistErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/enablepapertrail.go b/models/sdkerrors/enablepapertrail.go index 5e0708b..dc722d7 100644 --- a/models/sdkerrors/enablepapertrail.go +++ b/models/sdkerrors/enablepapertrail.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type EnablePaperTrailErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type EnablePaperTrailLogErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *EnablePaperTrailErrors) GetCode() *float64 { +func (o *EnablePaperTrailLogErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *EnablePaperTrailLogErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *EnablePaperTrailLogErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// EnablePaperTrailLogResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type EnablePaperTrailLogResponseBody struct { + Errors []EnablePaperTrailLogErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &EnablePaperTrailLogResponseBody{} + +func (e *EnablePaperTrailLogResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type EnablePaperTrailErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *EnablePaperTrailErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *EnablePaperTrailErrors) GetMessage() *string { return o.Message } -func (o *EnablePaperTrailErrors) GetStatus() *float64 { +func (o *EnablePaperTrailErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// EnablePaperTrailResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// EnablePaperTrailResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type EnablePaperTrailResponseBody struct { Errors []EnablePaperTrailErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getalllibraries.go b/models/sdkerrors/getalllibraries.go new file mode 100644 index 0000000..b0c6bfa --- /dev/null +++ b/models/sdkerrors/getalllibraries.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetAllLibrariesLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetAllLibrariesLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetAllLibrariesLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetAllLibrariesLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetAllLibrariesLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetAllLibrariesLibraryResponseBody struct { + Errors []GetAllLibrariesLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetAllLibrariesLibraryResponseBody{} + +func (e *GetAllLibrariesLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetAllLibrariesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetAllLibrariesErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetAllLibrariesErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetAllLibrariesErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetAllLibrariesResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetAllLibrariesResponseBody struct { + Errors []GetAllLibrariesErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetAllLibrariesResponseBody{} + +func (e *GetAllLibrariesResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getavailableclients.go b/models/sdkerrors/getavailableclients.go index 0d1fcc5..c11c563 100644 --- a/models/sdkerrors/getavailableclients.go +++ b/models/sdkerrors/getavailableclients.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetAvailableClientsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetAvailableClientsServerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetAvailableClientsErrors) GetCode() *float64 { +func (o *GetAvailableClientsServerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetAvailableClientsServerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetAvailableClientsServerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetAvailableClientsServerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetAvailableClientsServerResponseBody struct { + Errors []GetAvailableClientsServerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetAvailableClientsServerResponseBody{} + +func (e *GetAvailableClientsServerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetAvailableClientsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetAvailableClientsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetAvailableClientsErrors) GetMessage() *string { return o.Message } -func (o *GetAvailableClientsErrors) GetStatus() *float64 { +func (o *GetAvailableClientsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetAvailableClientsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetAvailableClientsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetAvailableClientsResponseBody struct { Errors []GetAvailableClientsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getbandwidthstatistics.go b/models/sdkerrors/getbandwidthstatistics.go index 6872d86..75571e4 100644 --- a/models/sdkerrors/getbandwidthstatistics.go +++ b/models/sdkerrors/getbandwidthstatistics.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetBandwidthStatisticsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetBandwidthStatisticsStatisticsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetBandwidthStatisticsErrors) GetCode() *float64 { +func (o *GetBandwidthStatisticsStatisticsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetBandwidthStatisticsStatisticsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetBandwidthStatisticsStatisticsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetBandwidthStatisticsStatisticsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetBandwidthStatisticsStatisticsResponseBody struct { + Errors []GetBandwidthStatisticsStatisticsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetBandwidthStatisticsStatisticsResponseBody{} + +func (e *GetBandwidthStatisticsStatisticsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetBandwidthStatisticsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetBandwidthStatisticsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetBandwidthStatisticsErrors) GetMessage() *string { return o.Message } -func (o *GetBandwidthStatisticsErrors) GetStatus() *float64 { +func (o *GetBandwidthStatisticsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetBandwidthStatisticsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetBandwidthStatisticsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetBandwidthStatisticsResponseBody struct { Errors []GetBandwidthStatisticsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getbannerimage.go b/models/sdkerrors/getbannerimage.go new file mode 100644 index 0000000..5ee5afd --- /dev/null +++ b/models/sdkerrors/getbannerimage.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetBannerImageMediaErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetBannerImageMediaErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetBannerImageMediaErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetBannerImageMediaErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetBannerImageMediaResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetBannerImageMediaResponseBody struct { + Errors []GetBannerImageMediaErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetBannerImageMediaResponseBody{} + +func (e *GetBannerImageMediaResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetBannerImageErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetBannerImageErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetBannerImageErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetBannerImageErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetBannerImageResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetBannerImageResponseBody struct { + Errors []GetBannerImageErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetBannerImageResponseBody{} + +func (e *GetBannerImageResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getbutlertasks.go b/models/sdkerrors/getbutlertasks.go index 7ef4939..2625e6f 100644 --- a/models/sdkerrors/getbutlertasks.go +++ b/models/sdkerrors/getbutlertasks.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetButlerTasksErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetButlerTasksButlerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetButlerTasksErrors) GetCode() *float64 { +func (o *GetButlerTasksButlerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetButlerTasksButlerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetButlerTasksButlerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetButlerTasksButlerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetButlerTasksButlerResponseBody struct { + Errors []GetButlerTasksButlerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetButlerTasksButlerResponseBody{} + +func (e *GetButlerTasksButlerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetButlerTasksErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetButlerTasksErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetButlerTasksErrors) GetMessage() *string { return o.Message } -func (o *GetButlerTasksErrors) GetStatus() *float64 { +func (o *GetButlerTasksErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetButlerTasksResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetButlerTasksResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetButlerTasksResponseBody struct { Errors []GetButlerTasksErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getcompanionsdata.go b/models/sdkerrors/getcompanionsdata.go new file mode 100644 index 0000000..7988468 --- /dev/null +++ b/models/sdkerrors/getcompanionsdata.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetCompanionsDataPlexErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetCompanionsDataPlexErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetCompanionsDataPlexErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetCompanionsDataPlexErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetCompanionsDataPlexResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetCompanionsDataPlexResponseBody struct { + Errors []GetCompanionsDataPlexErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetCompanionsDataPlexResponseBody{} + +func (e *GetCompanionsDataPlexResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetCompanionsDataErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetCompanionsDataErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetCompanionsDataErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetCompanionsDataErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetCompanionsDataResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetCompanionsDataResponseBody struct { + Errors []GetCompanionsDataErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetCompanionsDataResponseBody{} + +func (e *GetCompanionsDataResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getdevices.go b/models/sdkerrors/getdevices.go index 2a15328..4c9c836 100644 --- a/models/sdkerrors/getdevices.go +++ b/models/sdkerrors/getdevices.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetDevicesErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetDevicesServerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetDevicesErrors) GetCode() *float64 { +func (o *GetDevicesServerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetDevicesServerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetDevicesServerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetDevicesServerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetDevicesServerResponseBody struct { + Errors []GetDevicesServerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetDevicesServerResponseBody{} + +func (e *GetDevicesServerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetDevicesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetDevicesErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetDevicesErrors) GetMessage() *string { return o.Message } -func (o *GetDevicesErrors) GetStatus() *float64 { +func (o *GetDevicesErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetDevicesResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetDevicesResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetDevicesResponseBody struct { Errors []GetDevicesErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getfilehash.go b/models/sdkerrors/getfilehash.go index a9fc2a0..adb2013 100644 --- a/models/sdkerrors/getfilehash.go +++ b/models/sdkerrors/getfilehash.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetFileHashErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetFileHashLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetFileHashErrors) GetCode() *float64 { +func (o *GetFileHashLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetFileHashLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetFileHashLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetFileHashLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetFileHashLibraryResponseBody struct { + Errors []GetFileHashLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetFileHashLibraryResponseBody{} + +func (e *GetFileHashLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetFileHashErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetFileHashErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetFileHashErrors) GetMessage() *string { return o.Message } -func (o *GetFileHashErrors) GetStatus() *float64 { +func (o *GetFileHashErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetFileHashResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetFileHashResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetFileHashResponseBody struct { Errors []GetFileHashErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getgeodata.go b/models/sdkerrors/getgeodata.go new file mode 100644 index 0000000..d876f33 --- /dev/null +++ b/models/sdkerrors/getgeodata.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetGeoDataPlexErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetGeoDataPlexErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetGeoDataPlexErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetGeoDataPlexErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetGeoDataPlexResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetGeoDataPlexResponseBody struct { + Errors []GetGeoDataPlexErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetGeoDataPlexResponseBody{} + +func (e *GetGeoDataPlexResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetGeoDataErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetGeoDataErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetGeoDataErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetGeoDataErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetGeoDataResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetGeoDataResponseBody struct { + Errors []GetGeoDataErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetGeoDataResponseBody{} + +func (e *GetGeoDataResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getglobalhubs.go b/models/sdkerrors/getglobalhubs.go index 6178286..0994bd9 100644 --- a/models/sdkerrors/getglobalhubs.go +++ b/models/sdkerrors/getglobalhubs.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetGlobalHubsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetGlobalHubsHubsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetGlobalHubsErrors) GetCode() *float64 { +func (o *GetGlobalHubsHubsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetGlobalHubsHubsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetGlobalHubsHubsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetGlobalHubsHubsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetGlobalHubsHubsResponseBody struct { + Errors []GetGlobalHubsHubsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetGlobalHubsHubsResponseBody{} + +func (e *GetGlobalHubsHubsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetGlobalHubsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetGlobalHubsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetGlobalHubsErrors) GetMessage() *string { return o.Message } -func (o *GetGlobalHubsErrors) GetStatus() *float64 { +func (o *GetGlobalHubsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetGlobalHubsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetGlobalHubsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetGlobalHubsResponseBody struct { Errors []GetGlobalHubsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/gethomedata.go b/models/sdkerrors/gethomedata.go index 6a770a0..c9e787d 100644 --- a/models/sdkerrors/gethomedata.go +++ b/models/sdkerrors/gethomedata.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetHomeDataErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetHomeDataPlexErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetHomeDataErrors) GetCode() *float64 { +func (o *GetHomeDataPlexErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetHomeDataPlexErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetHomeDataPlexErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetHomeDataPlexResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetHomeDataPlexResponseBody struct { + Errors []GetHomeDataPlexErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetHomeDataPlexResponseBody{} + +func (e *GetHomeDataPlexResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetHomeDataErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetHomeDataErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetHomeDataErrors) GetMessage() *string { return o.Message } -func (o *GetHomeDataErrors) GetStatus() *float64 { +func (o *GetHomeDataErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetHomeDataResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetHomeDataResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetHomeDataResponseBody struct { Errors []GetHomeDataErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getlibraries.go b/models/sdkerrors/getlibraries.go deleted file mode 100644 index 5cb1cf2..0000000 --- a/models/sdkerrors/getlibraries.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package sdkerrors - -import ( - "encoding/json" - "net/http" -) - -type GetLibrariesErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` -} - -func (o *GetLibrariesErrors) GetCode() *float64 { - if o == nil { - return nil - } - return o.Code -} - -func (o *GetLibrariesErrors) GetMessage() *string { - if o == nil { - return nil - } - return o.Message -} - -func (o *GetLibrariesErrors) GetStatus() *float64 { - if o == nil { - return nil - } - return o.Status -} - -// GetLibrariesResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. -type GetLibrariesResponseBody struct { - Errors []GetLibrariesErrors `json:"errors,omitempty"` - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response `json:"-"` -} - -var _ error = &GetLibrariesResponseBody{} - -func (e *GetLibrariesResponseBody) Error() string { - data, _ := json.Marshal(e) - return string(data) -} diff --git a/models/sdkerrors/getlibrary.go b/models/sdkerrors/getlibrary.go deleted file mode 100644 index 7fbe3b6..0000000 --- a/models/sdkerrors/getlibrary.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package sdkerrors - -import ( - "encoding/json" - "net/http" -) - -type GetLibraryErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` -} - -func (o *GetLibraryErrors) GetCode() *float64 { - if o == nil { - return nil - } - return o.Code -} - -func (o *GetLibraryErrors) GetMessage() *string { - if o == nil { - return nil - } - return o.Message -} - -func (o *GetLibraryErrors) GetStatus() *float64 { - if o == nil { - return nil - } - return o.Status -} - -// GetLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. -type GetLibraryResponseBody struct { - Errors []GetLibraryErrors `json:"errors,omitempty"` - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response `json:"-"` -} - -var _ error = &GetLibraryResponseBody{} - -func (e *GetLibraryResponseBody) Error() string { - data, _ := json.Marshal(e) - return string(data) -} diff --git a/models/sdkerrors/getlibrarydetails.go b/models/sdkerrors/getlibrarydetails.go new file mode 100644 index 0000000..9ff630b --- /dev/null +++ b/models/sdkerrors/getlibrarydetails.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetLibraryDetailsLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetLibraryDetailsLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetLibraryDetailsLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetLibraryDetailsLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetLibraryDetailsLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetLibraryDetailsLibraryResponseBody struct { + Errors []GetLibraryDetailsLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetLibraryDetailsLibraryResponseBody{} + +func (e *GetLibraryDetailsLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetLibraryDetailsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetLibraryDetailsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetLibraryDetailsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetLibraryDetailsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetLibraryDetailsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetLibraryDetailsResponseBody struct { + Errors []GetLibraryDetailsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetLibraryDetailsResponseBody{} + +func (e *GetLibraryDetailsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getlibraryhubs.go b/models/sdkerrors/getlibraryhubs.go index 1509759..c5f9311 100644 --- a/models/sdkerrors/getlibraryhubs.go +++ b/models/sdkerrors/getlibraryhubs.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetLibraryHubsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetLibraryHubsHubsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetLibraryHubsErrors) GetCode() *float64 { +func (o *GetLibraryHubsHubsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetLibraryHubsHubsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetLibraryHubsHubsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetLibraryHubsHubsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetLibraryHubsHubsResponseBody struct { + Errors []GetLibraryHubsHubsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetLibraryHubsHubsResponseBody{} + +func (e *GetLibraryHubsHubsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetLibraryHubsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetLibraryHubsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetLibraryHubsErrors) GetMessage() *string { return o.Message } -func (o *GetLibraryHubsErrors) GetStatus() *float64 { +func (o *GetLibraryHubsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetLibraryHubsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetLibraryHubsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetLibraryHubsResponseBody struct { Errors []GetLibraryHubsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getlibraryitems.go b/models/sdkerrors/getlibraryitems.go index 63c340d..edd5a9f 100644 --- a/models/sdkerrors/getlibraryitems.go +++ b/models/sdkerrors/getlibraryitems.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetLibraryItemsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetLibraryItemsLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetLibraryItemsErrors) GetCode() *float64 { +func (o *GetLibraryItemsLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetLibraryItemsLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetLibraryItemsLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetLibraryItemsLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetLibraryItemsLibraryResponseBody struct { + Errors []GetLibraryItemsLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetLibraryItemsLibraryResponseBody{} + +func (e *GetLibraryItemsLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetLibraryItemsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetLibraryItemsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetLibraryItemsErrors) GetMessage() *string { return o.Message } -func (o *GetLibraryItemsErrors) GetStatus() *float64 { +func (o *GetLibraryItemsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetLibraryItemsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetLibraryItemsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetLibraryItemsResponseBody struct { Errors []GetLibraryItemsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getmediaproviders.go b/models/sdkerrors/getmediaproviders.go new file mode 100644 index 0000000..6500862 --- /dev/null +++ b/models/sdkerrors/getmediaproviders.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetMediaProvidersServerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetMediaProvidersServerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetMediaProvidersServerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetMediaProvidersServerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetMediaProvidersServerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetMediaProvidersServerResponseBody struct { + Errors []GetMediaProvidersServerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetMediaProvidersServerResponseBody{} + +func (e *GetMediaProvidersServerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetMediaProvidersErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetMediaProvidersErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetMediaProvidersErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetMediaProvidersErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetMediaProvidersResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetMediaProvidersResponseBody struct { + Errors []GetMediaProvidersErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetMediaProvidersResponseBody{} + +func (e *GetMediaProvidersResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getmetadata.go b/models/sdkerrors/getmetadata.go deleted file mode 100644 index 9eb9512..0000000 --- a/models/sdkerrors/getmetadata.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package sdkerrors - -import ( - "encoding/json" - "net/http" -) - -type GetMetadataErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` -} - -func (o *GetMetadataErrors) GetCode() *float64 { - if o == nil { - return nil - } - return o.Code -} - -func (o *GetMetadataErrors) GetMessage() *string { - if o == nil { - return nil - } - return o.Message -} - -func (o *GetMetadataErrors) GetStatus() *float64 { - if o == nil { - return nil - } - return o.Status -} - -// GetMetadataResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. -type GetMetadataResponseBody struct { - Errors []GetMetadataErrors `json:"errors,omitempty"` - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response `json:"-"` -} - -var _ error = &GetMetadataResponseBody{} - -func (e *GetMetadataResponseBody) Error() string { - data, _ := json.Marshal(e) - return string(data) -} diff --git a/models/sdkerrors/getmetadatabyratingkey.go b/models/sdkerrors/getmetadatabyratingkey.go new file mode 100644 index 0000000..2dafa5c --- /dev/null +++ b/models/sdkerrors/getmetadatabyratingkey.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetMetaDataByRatingKeyLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetMetaDataByRatingKeyLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetMetaDataByRatingKeyLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetMetaDataByRatingKeyLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetMetaDataByRatingKeyLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetMetaDataByRatingKeyLibraryResponseBody struct { + Errors []GetMetaDataByRatingKeyLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetMetaDataByRatingKeyLibraryResponseBody{} + +func (e *GetMetaDataByRatingKeyLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetMetaDataByRatingKeyErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetMetaDataByRatingKeyErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetMetaDataByRatingKeyErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetMetaDataByRatingKeyErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetMetaDataByRatingKeyResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetMetaDataByRatingKeyResponseBody struct { + Errors []GetMetaDataByRatingKeyErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetMetaDataByRatingKeyResponseBody{} + +func (e *GetMetaDataByRatingKeyResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getmetadatachildren.go b/models/sdkerrors/getmetadatachildren.go index 0c9e7cc..14a902e 100644 --- a/models/sdkerrors/getmetadatachildren.go +++ b/models/sdkerrors/getmetadatachildren.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetMetadataChildrenErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetMetadataChildrenLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetMetadataChildrenErrors) GetCode() *float64 { +func (o *GetMetadataChildrenLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetMetadataChildrenLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetMetadataChildrenLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetMetadataChildrenLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetMetadataChildrenLibraryResponseBody struct { + Errors []GetMetadataChildrenLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetMetadataChildrenLibraryResponseBody{} + +func (e *GetMetadataChildrenLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetMetadataChildrenErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetMetadataChildrenErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetMetadataChildrenErrors) GetMessage() *string { return o.Message } -func (o *GetMetadataChildrenErrors) GetStatus() *float64 { +func (o *GetMetadataChildrenErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetMetadataChildrenResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetMetadataChildrenResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetMetadataChildrenResponseBody struct { Errors []GetMetadataChildrenErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getmyplexaccount.go b/models/sdkerrors/getmyplexaccount.go index 56e1493..6fc4db7 100644 --- a/models/sdkerrors/getmyplexaccount.go +++ b/models/sdkerrors/getmyplexaccount.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetMyPlexAccountErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetMyPlexAccountServerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetMyPlexAccountErrors) GetCode() *float64 { +func (o *GetMyPlexAccountServerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetMyPlexAccountServerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetMyPlexAccountServerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetMyPlexAccountServerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetMyPlexAccountServerResponseBody struct { + Errors []GetMyPlexAccountServerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetMyPlexAccountServerResponseBody{} + +func (e *GetMyPlexAccountServerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetMyPlexAccountErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetMyPlexAccountErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetMyPlexAccountErrors) GetMessage() *string { return o.Message } -func (o *GetMyPlexAccountErrors) GetStatus() *float64 { +func (o *GetMyPlexAccountErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetMyPlexAccountResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetMyPlexAccountResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetMyPlexAccountResponseBody struct { Errors []GetMyPlexAccountErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getondeck.go b/models/sdkerrors/getondeck.go index 50b9df4..e5302f8 100644 --- a/models/sdkerrors/getondeck.go +++ b/models/sdkerrors/getondeck.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetOnDeckErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetOnDeckLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetOnDeckErrors) GetCode() *float64 { +func (o *GetOnDeckLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetOnDeckLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetOnDeckLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetOnDeckLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetOnDeckLibraryResponseBody struct { + Errors []GetOnDeckLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetOnDeckLibraryResponseBody{} + +func (e *GetOnDeckLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetOnDeckErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetOnDeckErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetOnDeckErrors) GetMessage() *string { return o.Message } -func (o *GetOnDeckErrors) GetStatus() *float64 { +func (o *GetOnDeckErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetOnDeckResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetOnDeckResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetOnDeckResponseBody struct { Errors []GetOnDeckErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getpin.go b/models/sdkerrors/getpin.go index fea2e4e..31ead4d 100644 --- a/models/sdkerrors/getpin.go +++ b/models/sdkerrors/getpin.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -8,12 +8,12 @@ import ( ) type GetPinErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetPinErrors) GetCode() *float64 { +func (o *GetPinErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +27,14 @@ func (o *GetPinErrors) GetMessage() *string { return o.Message } -func (o *GetPinErrors) GetStatus() *float64 { +func (o *GetPinErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetPinResponseBody - X-Plex-Client-Identifier is missing +// GetPinResponseBody - Bad Request response when the X-Plex-Client-Identifier is missing type GetPinResponseBody struct { Errors []GetPinErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getplaylist.go b/models/sdkerrors/getplaylist.go index c3b4a68..2c27035 100644 --- a/models/sdkerrors/getplaylist.go +++ b/models/sdkerrors/getplaylist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetPlaylistErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetPlaylistPlaylistsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetPlaylistErrors) GetCode() *float64 { +func (o *GetPlaylistPlaylistsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetPlaylistPlaylistsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetPlaylistPlaylistsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetPlaylistPlaylistsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetPlaylistPlaylistsResponseBody struct { + Errors []GetPlaylistPlaylistsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetPlaylistPlaylistsResponseBody{} + +func (e *GetPlaylistPlaylistsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetPlaylistErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetPlaylistErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetPlaylistErrors) GetMessage() *string { return o.Message } -func (o *GetPlaylistErrors) GetStatus() *float64 { +func (o *GetPlaylistErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetPlaylistResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetPlaylistResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetPlaylistResponseBody struct { Errors []GetPlaylistErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getplaylistcontents.go b/models/sdkerrors/getplaylistcontents.go index 64ce459..5782e1f 100644 --- a/models/sdkerrors/getplaylistcontents.go +++ b/models/sdkerrors/getplaylistcontents.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetPlaylistContentsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetPlaylistContentsPlaylistsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetPlaylistContentsErrors) GetCode() *float64 { +func (o *GetPlaylistContentsPlaylistsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetPlaylistContentsPlaylistsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetPlaylistContentsPlaylistsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetPlaylistContentsPlaylistsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetPlaylistContentsPlaylistsResponseBody struct { + Errors []GetPlaylistContentsPlaylistsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetPlaylistContentsPlaylistsResponseBody{} + +func (e *GetPlaylistContentsPlaylistsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetPlaylistContentsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetPlaylistContentsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetPlaylistContentsErrors) GetMessage() *string { return o.Message } -func (o *GetPlaylistContentsErrors) GetStatus() *float64 { +func (o *GetPlaylistContentsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetPlaylistContentsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetPlaylistContentsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetPlaylistContentsResponseBody struct { Errors []GetPlaylistContentsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getplaylists.go b/models/sdkerrors/getplaylists.go index 6227a33..5790438 100644 --- a/models/sdkerrors/getplaylists.go +++ b/models/sdkerrors/getplaylists.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetPlaylistsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetPlaylistsPlaylistsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetPlaylistsErrors) GetCode() *float64 { +func (o *GetPlaylistsPlaylistsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetPlaylistsPlaylistsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetPlaylistsPlaylistsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetPlaylistsPlaylistsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetPlaylistsPlaylistsResponseBody struct { + Errors []GetPlaylistsPlaylistsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetPlaylistsPlaylistsResponseBody{} + +func (e *GetPlaylistsPlaylistsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetPlaylistsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetPlaylistsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetPlaylistsErrors) GetMessage() *string { return o.Message } -func (o *GetPlaylistsErrors) GetStatus() *float64 { +func (o *GetPlaylistsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetPlaylistsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetPlaylistsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetPlaylistsResponseBody struct { Errors []GetPlaylistsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getrecentlyadded.go b/models/sdkerrors/getrecentlyadded.go index 43652d8..81f2a3e 100644 --- a/models/sdkerrors/getrecentlyadded.go +++ b/models/sdkerrors/getrecentlyadded.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetRecentlyAddedErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetRecentlyAddedLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetRecentlyAddedErrors) GetCode() *float64 { +func (o *GetRecentlyAddedLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetRecentlyAddedLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetRecentlyAddedLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetRecentlyAddedLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetRecentlyAddedLibraryResponseBody struct { + Errors []GetRecentlyAddedLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetRecentlyAddedLibraryResponseBody{} + +func (e *GetRecentlyAddedLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetRecentlyAddedErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetRecentlyAddedErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetRecentlyAddedErrors) GetMessage() *string { return o.Message } -func (o *GetRecentlyAddedErrors) GetStatus() *float64 { +func (o *GetRecentlyAddedErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetRecentlyAddedResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetRecentlyAddedResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetRecentlyAddedResponseBody struct { Errors []GetRecentlyAddedErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getrefreshlibrarymetadata.go b/models/sdkerrors/getrefreshlibrarymetadata.go new file mode 100644 index 0000000..aef29e8 --- /dev/null +++ b/models/sdkerrors/getrefreshlibrarymetadata.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetRefreshLibraryMetadataLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetRefreshLibraryMetadataLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetRefreshLibraryMetadataLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetRefreshLibraryMetadataLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetRefreshLibraryMetadataLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetRefreshLibraryMetadataLibraryResponseBody struct { + Errors []GetRefreshLibraryMetadataLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetRefreshLibraryMetadataLibraryResponseBody{} + +func (e *GetRefreshLibraryMetadataLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetRefreshLibraryMetadataErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetRefreshLibraryMetadataErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetRefreshLibraryMetadataErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetRefreshLibraryMetadataErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetRefreshLibraryMetadataResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetRefreshLibraryMetadataResponseBody struct { + Errors []GetRefreshLibraryMetadataErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetRefreshLibraryMetadataResponseBody{} + +func (e *GetRefreshLibraryMetadataResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getresizedphoto.go b/models/sdkerrors/getresizedphoto.go index e83f146..41316c1 100644 --- a/models/sdkerrors/getresizedphoto.go +++ b/models/sdkerrors/getresizedphoto.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetResizedPhotoErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetResizedPhotoServerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetResizedPhotoErrors) GetCode() *float64 { +func (o *GetResizedPhotoServerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetResizedPhotoServerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetResizedPhotoServerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetResizedPhotoServerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetResizedPhotoServerResponseBody struct { + Errors []GetResizedPhotoServerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetResizedPhotoServerResponseBody{} + +func (e *GetResizedPhotoServerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetResizedPhotoErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetResizedPhotoErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetResizedPhotoErrors) GetMessage() *string { return o.Message } -func (o *GetResizedPhotoErrors) GetStatus() *float64 { +func (o *GetResizedPhotoErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetResizedPhotoResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetResizedPhotoResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetResizedPhotoResponseBody struct { Errors []GetResizedPhotoErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getresourcesstatistics.go b/models/sdkerrors/getresourcesstatistics.go index 503c1df..d92f00f 100644 --- a/models/sdkerrors/getresourcesstatistics.go +++ b/models/sdkerrors/getresourcesstatistics.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetResourcesStatisticsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetResourcesStatisticsStatisticsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetResourcesStatisticsErrors) GetCode() *float64 { +func (o *GetResourcesStatisticsStatisticsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetResourcesStatisticsStatisticsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetResourcesStatisticsStatisticsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetResourcesStatisticsStatisticsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetResourcesStatisticsStatisticsResponseBody struct { + Errors []GetResourcesStatisticsStatisticsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetResourcesStatisticsStatisticsResponseBody{} + +func (e *GetResourcesStatisticsStatisticsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetResourcesStatisticsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetResourcesStatisticsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetResourcesStatisticsErrors) GetMessage() *string { return o.Message } -func (o *GetResourcesStatisticsErrors) GetStatus() *float64 { +func (o *GetResourcesStatisticsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetResourcesStatisticsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetResourcesStatisticsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetResourcesStatisticsResponseBody struct { Errors []GetResourcesStatisticsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getsearchlibrary.go b/models/sdkerrors/getsearchlibrary.go new file mode 100644 index 0000000..63df3d4 --- /dev/null +++ b/models/sdkerrors/getsearchlibrary.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetSearchLibraryLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetSearchLibraryLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetSearchLibraryLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetSearchLibraryLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetSearchLibraryLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetSearchLibraryLibraryResponseBody struct { + Errors []GetSearchLibraryLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetSearchLibraryLibraryResponseBody{} + +func (e *GetSearchLibraryLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetSearchLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetSearchLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetSearchLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetSearchLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetSearchLibraryResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetSearchLibraryResponseBody struct { + Errors []GetSearchLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetSearchLibraryResponseBody{} + +func (e *GetSearchLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getsearchresults.go b/models/sdkerrors/getsearchresults.go index 22301ed..99da498 100644 --- a/models/sdkerrors/getsearchresults.go +++ b/models/sdkerrors/getsearchresults.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetSearchResultsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetSearchResultsSearchErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetSearchResultsErrors) GetCode() *float64 { +func (o *GetSearchResultsSearchErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetSearchResultsSearchErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetSearchResultsSearchErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetSearchResultsSearchResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetSearchResultsSearchResponseBody struct { + Errors []GetSearchResultsSearchErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetSearchResultsSearchResponseBody{} + +func (e *GetSearchResultsSearchResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetSearchResultsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetSearchResultsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetSearchResultsErrors) GetMessage() *string { return o.Message } -func (o *GetSearchResultsErrors) GetStatus() *float64 { +func (o *GetSearchResultsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetSearchResultsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetSearchResultsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetSearchResultsResponseBody struct { Errors []GetSearchResultsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getserveractivities.go b/models/sdkerrors/getserveractivities.go index 549d9d6..556da4e 100644 --- a/models/sdkerrors/getserveractivities.go +++ b/models/sdkerrors/getserveractivities.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetServerActivitiesErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetServerActivitiesActivitiesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetServerActivitiesErrors) GetCode() *float64 { +func (o *GetServerActivitiesActivitiesErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetServerActivitiesActivitiesErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetServerActivitiesActivitiesErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetServerActivitiesActivitiesResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetServerActivitiesActivitiesResponseBody struct { + Errors []GetServerActivitiesActivitiesErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetServerActivitiesActivitiesResponseBody{} + +func (e *GetServerActivitiesActivitiesResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetServerActivitiesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetServerActivitiesErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetServerActivitiesErrors) GetMessage() *string { return o.Message } -func (o *GetServerActivitiesErrors) GetStatus() *float64 { +func (o *GetServerActivitiesErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetServerActivitiesResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetServerActivitiesResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetServerActivitiesResponseBody struct { Errors []GetServerActivitiesErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getservercapabilities.go b/models/sdkerrors/getservercapabilities.go index a7192b8..49be573 100644 --- a/models/sdkerrors/getservercapabilities.go +++ b/models/sdkerrors/getservercapabilities.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type Errors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetServerCapabilitiesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *Errors) GetCode() *float64 { +func (o *GetServerCapabilitiesErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetServerCapabilitiesErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetServerCapabilitiesErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetServerCapabilitiesServerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetServerCapabilitiesServerResponseBody struct { + Errors []GetServerCapabilitiesErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetServerCapabilitiesServerResponseBody{} + +func (e *GetServerCapabilitiesServerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type Errors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *Errors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *Errors) GetMessage() *string { return o.Message } -func (o *Errors) GetStatus() *float64 { +func (o *Errors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetServerCapabilitiesResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetServerCapabilitiesResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetServerCapabilitiesResponseBody struct { Errors []Errors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getserveridentity.go b/models/sdkerrors/getserveridentity.go index 456b8b1..fc50500 100644 --- a/models/sdkerrors/getserveridentity.go +++ b/models/sdkerrors/getserveridentity.go @@ -1,42 +1,15 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors import ( - "encoding/json" "net/http" ) -type GetServerIdentityErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` -} - -func (o *GetServerIdentityErrors) GetCode() *float64 { - if o == nil { - return nil - } - return o.Code -} - -func (o *GetServerIdentityErrors) GetMessage() *string { - if o == nil { - return nil - } - return o.Message -} - -func (o *GetServerIdentityErrors) GetStatus() *float64 { - if o == nil { - return nil - } - return o.Status -} - -// GetServerIdentityResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetServerIdentityResponseBody - Request Timeout type GetServerIdentityResponseBody struct { - Errors []GetServerIdentityErrors `json:"errors,omitempty"` + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response `json:"-"` } @@ -44,6 +17,9 @@ type GetServerIdentityResponseBody struct { var _ error = &GetServerIdentityResponseBody{} func (e *GetServerIdentityResponseBody) Error() string { - data, _ := json.Marshal(e) - return string(data) + if e.Message == nil { + return "unknown error" + } + + return *e.Message } diff --git a/models/sdkerrors/getserverlist.go b/models/sdkerrors/getserverlist.go index 452ac97..125fef6 100644 --- a/models/sdkerrors/getserverlist.go +++ b/models/sdkerrors/getserverlist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetServerListErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetServerListServerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetServerListErrors) GetCode() *float64 { +func (o *GetServerListServerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetServerListServerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetServerListServerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetServerListServerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetServerListServerResponseBody struct { + Errors []GetServerListServerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetServerListServerResponseBody{} + +func (e *GetServerListServerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetServerListErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetServerListErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetServerListErrors) GetMessage() *string { return o.Message } -func (o *GetServerListErrors) GetStatus() *float64 { +func (o *GetServerListErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetServerListResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetServerListResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetServerListResponseBody struct { Errors []GetServerListErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getserverpreferences.go b/models/sdkerrors/getserverpreferences.go index e42c61b..97a60d2 100644 --- a/models/sdkerrors/getserverpreferences.go +++ b/models/sdkerrors/getserverpreferences.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetServerPreferencesErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetServerPreferencesServerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetServerPreferencesErrors) GetCode() *float64 { +func (o *GetServerPreferencesServerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetServerPreferencesServerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetServerPreferencesServerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetServerPreferencesServerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetServerPreferencesServerResponseBody struct { + Errors []GetServerPreferencesServerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetServerPreferencesServerResponseBody{} + +func (e *GetServerPreferencesServerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetServerPreferencesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetServerPreferencesErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetServerPreferencesErrors) GetMessage() *string { return o.Message } -func (o *GetServerPreferencesErrors) GetStatus() *float64 { +func (o *GetServerPreferencesErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetServerPreferencesResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetServerPreferencesResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetServerPreferencesResponseBody struct { Errors []GetServerPreferencesErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getserverresources.go b/models/sdkerrors/getserverresources.go new file mode 100644 index 0000000..6344988 --- /dev/null +++ b/models/sdkerrors/getserverresources.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetServerResourcesPlexErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetServerResourcesPlexErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetServerResourcesPlexErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetServerResourcesPlexErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetServerResourcesPlexResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetServerResourcesPlexResponseBody struct { + Errors []GetServerResourcesPlexErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetServerResourcesPlexResponseBody{} + +func (e *GetServerResourcesPlexResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetServerResourcesErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetServerResourcesErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetServerResourcesErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetServerResourcesErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetServerResourcesResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetServerResourcesResponseBody struct { + Errors []GetServerResourcesErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetServerResourcesResponseBody{} + +func (e *GetServerResourcesResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getsessionhistory.go b/models/sdkerrors/getsessionhistory.go index a0d232d..b5d8207 100644 --- a/models/sdkerrors/getsessionhistory.go +++ b/models/sdkerrors/getsessionhistory.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetSessionHistoryErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetSessionHistorySessionsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetSessionHistoryErrors) GetCode() *float64 { +func (o *GetSessionHistorySessionsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetSessionHistorySessionsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetSessionHistorySessionsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetSessionHistorySessionsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetSessionHistorySessionsResponseBody struct { + Errors []GetSessionHistorySessionsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetSessionHistorySessionsResponseBody{} + +func (e *GetSessionHistorySessionsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetSessionHistoryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetSessionHistoryErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetSessionHistoryErrors) GetMessage() *string { return o.Message } -func (o *GetSessionHistoryErrors) GetStatus() *float64 { +func (o *GetSessionHistoryErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetSessionHistoryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetSessionHistoryResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetSessionHistoryResponseBody struct { Errors []GetSessionHistoryErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getsessions.go b/models/sdkerrors/getsessions.go index eac87c1..46964b9 100644 --- a/models/sdkerrors/getsessions.go +++ b/models/sdkerrors/getsessions.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetSessionsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetSessionsSessionsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetSessionsErrors) GetCode() *float64 { +func (o *GetSessionsSessionsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetSessionsSessionsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetSessionsSessionsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetSessionsSessionsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetSessionsSessionsResponseBody struct { + Errors []GetSessionsSessionsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetSessionsSessionsResponseBody{} + +func (e *GetSessionsSessionsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetSessionsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetSessionsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetSessionsErrors) GetMessage() *string { return o.Message } -func (o *GetSessionsErrors) GetStatus() *float64 { +func (o *GetSessionsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetSessionsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetSessionsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetSessionsResponseBody struct { Errors []GetSessionsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getsourceconnectioninformation.go b/models/sdkerrors/getsourceconnectioninformation.go index 9f2d316..ead5c8d 100644 --- a/models/sdkerrors/getsourceconnectioninformation.go +++ b/models/sdkerrors/getsourceconnectioninformation.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetSourceConnectionInformationErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetSourceConnectionInformationAuthenticationErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetSourceConnectionInformationErrors) GetCode() *float64 { +func (o *GetSourceConnectionInformationAuthenticationErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetSourceConnectionInformationAuthenticationErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetSourceConnectionInformationAuthenticationErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetSourceConnectionInformationAuthenticationResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetSourceConnectionInformationAuthenticationResponseBody struct { + Errors []GetSourceConnectionInformationAuthenticationErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetSourceConnectionInformationAuthenticationResponseBody{} + +func (e *GetSourceConnectionInformationAuthenticationResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetSourceConnectionInformationErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetSourceConnectionInformationErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetSourceConnectionInformationErrors) GetMessage() *string { return o.Message } -func (o *GetSourceConnectionInformationErrors) GetStatus() *float64 { +func (o *GetSourceConnectionInformationErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetSourceConnectionInformationResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetSourceConnectionInformationResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetSourceConnectionInformationResponseBody struct { Errors []GetSourceConnectionInformationErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getstatistics.go b/models/sdkerrors/getstatistics.go index 0c7d140..c2e67d2 100644 --- a/models/sdkerrors/getstatistics.go +++ b/models/sdkerrors/getstatistics.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetStatisticsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetStatisticsStatisticsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetStatisticsErrors) GetCode() *float64 { +func (o *GetStatisticsStatisticsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetStatisticsStatisticsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetStatisticsStatisticsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetStatisticsStatisticsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetStatisticsStatisticsResponseBody struct { + Errors []GetStatisticsStatisticsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetStatisticsStatisticsResponseBody{} + +func (e *GetStatisticsStatisticsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetStatisticsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetStatisticsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetStatisticsErrors) GetMessage() *string { return o.Message } -func (o *GetStatisticsErrors) GetStatus() *float64 { +func (o *GetStatisticsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetStatisticsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetStatisticsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetStatisticsResponseBody struct { Errors []GetStatisticsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getthumbimage.go b/models/sdkerrors/getthumbimage.go new file mode 100644 index 0000000..b3a138d --- /dev/null +++ b/models/sdkerrors/getthumbimage.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetThumbImageMediaErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetThumbImageMediaErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetThumbImageMediaErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetThumbImageMediaErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetThumbImageMediaResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetThumbImageMediaResponseBody struct { + Errors []GetThumbImageMediaErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetThumbImageMediaResponseBody{} + +func (e *GetThumbImageMediaResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetThumbImageErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetThumbImageErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetThumbImageErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetThumbImageErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetThumbImageResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetThumbImageResponseBody struct { + Errors []GetThumbImageErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetThumbImageResponseBody{} + +func (e *GetThumbImageResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/gettimeline.go b/models/sdkerrors/gettimeline.go index 77996ed..1ac1183 100644 --- a/models/sdkerrors/gettimeline.go +++ b/models/sdkerrors/gettimeline.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetTimelineErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetTimelineVideoErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetTimelineErrors) GetCode() *float64 { +func (o *GetTimelineVideoErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetTimelineVideoErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetTimelineVideoErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetTimelineVideoResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetTimelineVideoResponseBody struct { + Errors []GetTimelineVideoErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetTimelineVideoResponseBody{} + +func (e *GetTimelineVideoResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetTimelineErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetTimelineErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetTimelineErrors) GetMessage() *string { return o.Message } -func (o *GetTimelineErrors) GetStatus() *float64 { +func (o *GetTimelineErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetTimelineResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetTimelineResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetTimelineResponseBody struct { Errors []GetTimelineErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/gettoken.go b/models/sdkerrors/gettoken.go deleted file mode 100644 index 0528c85..0000000 --- a/models/sdkerrors/gettoken.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package sdkerrors - -import ( - "encoding/json" - "net/http" -) - -type GetTokenErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` -} - -func (o *GetTokenErrors) GetCode() *float64 { - if o == nil { - return nil - } - return o.Code -} - -func (o *GetTokenErrors) GetMessage() *string { - if o == nil { - return nil - } - return o.Message -} - -func (o *GetTokenErrors) GetStatus() *float64 { - if o == nil { - return nil - } - return o.Status -} - -// GetTokenResponseBody - X-Plex-Client-Identifier is missing -type GetTokenResponseBody struct { - Errors []GetTokenErrors `json:"errors,omitempty"` - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response `json:"-"` -} - -var _ error = &GetTokenResponseBody{} - -func (e *GetTokenResponseBody) Error() string { - data, _ := json.Marshal(e) - return string(data) -} diff --git a/models/sdkerrors/gettokenbypinid.go b/models/sdkerrors/gettokenbypinid.go new file mode 100644 index 0000000..7e270fd --- /dev/null +++ b/models/sdkerrors/gettokenbypinid.go @@ -0,0 +1,82 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetTokenByPinIDPlexErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +func (o *GetTokenByPinIDPlexErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetTokenByPinIDPlexErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +// GetTokenByPinIDPlexResponseBody - Not Found or Expired +type GetTokenByPinIDPlexResponseBody struct { + Errors []GetTokenByPinIDPlexErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetTokenByPinIDPlexResponseBody{} + +func (e *GetTokenByPinIDPlexResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetTokenByPinIDErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetTokenByPinIDErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetTokenByPinIDErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetTokenByPinIDErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetTokenByPinIDResponseBody - Bad Request response when the X-Plex-Client-Identifier is missing +type GetTokenByPinIDResponseBody struct { + Errors []GetTokenByPinIDErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetTokenByPinIDResponseBody{} + +func (e *GetTokenByPinIDResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/gettopwatchedcontent.go b/models/sdkerrors/gettopwatchedcontent.go new file mode 100644 index 0000000..111c282 --- /dev/null +++ b/models/sdkerrors/gettopwatchedcontent.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetTopWatchedContentLibraryErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetTopWatchedContentLibraryErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetTopWatchedContentLibraryErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetTopWatchedContentLibraryErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetTopWatchedContentLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetTopWatchedContentLibraryResponseBody struct { + Errors []GetTopWatchedContentLibraryErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetTopWatchedContentLibraryResponseBody{} + +func (e *GetTopWatchedContentLibraryResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetTopWatchedContentErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetTopWatchedContentErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetTopWatchedContentErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetTopWatchedContentErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetTopWatchedContentResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetTopWatchedContentResponseBody struct { + Errors []GetTopWatchedContentErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetTopWatchedContentResponseBody{} + +func (e *GetTopWatchedContentResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/gettranscodesessions.go b/models/sdkerrors/gettranscodesessions.go index 48cbb34..f8d1d84 100644 --- a/models/sdkerrors/gettranscodesessions.go +++ b/models/sdkerrors/gettranscodesessions.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetTranscodeSessionsErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetTranscodeSessionsSessionsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetTranscodeSessionsErrors) GetCode() *float64 { +func (o *GetTranscodeSessionsSessionsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetTranscodeSessionsSessionsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetTranscodeSessionsSessionsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetTranscodeSessionsSessionsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetTranscodeSessionsSessionsResponseBody struct { + Errors []GetTranscodeSessionsSessionsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetTranscodeSessionsSessionsResponseBody{} + +func (e *GetTranscodeSessionsSessionsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetTranscodeSessionsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetTranscodeSessionsErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetTranscodeSessionsErrors) GetMessage() *string { return o.Message } -func (o *GetTranscodeSessionsErrors) GetStatus() *float64 { +func (o *GetTranscodeSessionsErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetTranscodeSessionsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetTranscodeSessionsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetTranscodeSessionsResponseBody struct { Errors []GetTranscodeSessionsErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/gettransienttoken.go b/models/sdkerrors/gettransienttoken.go index 772f1fa..5cff8d9 100644 --- a/models/sdkerrors/gettransienttoken.go +++ b/models/sdkerrors/gettransienttoken.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetTransientTokenErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetTransientTokenAuthenticationErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetTransientTokenErrors) GetCode() *float64 { +func (o *GetTransientTokenAuthenticationErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetTransientTokenAuthenticationErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetTransientTokenAuthenticationErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetTransientTokenAuthenticationResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetTransientTokenAuthenticationResponseBody struct { + Errors []GetTransientTokenAuthenticationErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetTransientTokenAuthenticationResponseBody{} + +func (e *GetTransientTokenAuthenticationResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetTransientTokenErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetTransientTokenErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetTransientTokenErrors) GetMessage() *string { return o.Message } -func (o *GetTransientTokenErrors) GetStatus() *float64 { +func (o *GetTransientTokenErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetTransientTokenResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetTransientTokenResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetTransientTokenResponseBody struct { Errors []GetTransientTokenErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getupdatestatus.go b/models/sdkerrors/getupdatestatus.go index 99c65b2..b125a5b 100644 --- a/models/sdkerrors/getupdatestatus.go +++ b/models/sdkerrors/getupdatestatus.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type GetUpdateStatusErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetUpdateStatusUpdaterErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetUpdateStatusErrors) GetCode() *float64 { +func (o *GetUpdateStatusUpdaterErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetUpdateStatusUpdaterErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetUpdateStatusUpdaterErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetUpdateStatusUpdaterResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetUpdateStatusUpdaterResponseBody struct { + Errors []GetUpdateStatusUpdaterErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetUpdateStatusUpdaterResponseBody{} + +func (e *GetUpdateStatusUpdaterResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetUpdateStatusErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetUpdateStatusErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *GetUpdateStatusErrors) GetMessage() *string { return o.Message } -func (o *GetUpdateStatusErrors) GetStatus() *float64 { +func (o *GetUpdateStatusErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetUpdateStatusResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// GetUpdateStatusResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type GetUpdateStatusResponseBody struct { Errors []GetUpdateStatusErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/getuserdetails.go b/models/sdkerrors/getuserdetails.go new file mode 100644 index 0000000..cd401db --- /dev/null +++ b/models/sdkerrors/getuserdetails.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetUserDetailsAuthenticationErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetUserDetailsAuthenticationErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetUserDetailsAuthenticationErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetUserDetailsAuthenticationErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetUserDetailsAuthenticationResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetUserDetailsAuthenticationResponseBody struct { + Errors []GetUserDetailsAuthenticationErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetUserDetailsAuthenticationResponseBody{} + +func (e *GetUserDetailsAuthenticationResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetUserDetailsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetUserDetailsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetUserDetailsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetUserDetailsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetUserDetailsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetUserDetailsResponseBody struct { + Errors []GetUserDetailsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetUserDetailsResponseBody{} + +func (e *GetUserDetailsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getuserfriends.go b/models/sdkerrors/getuserfriends.go new file mode 100644 index 0000000..eb06170 --- /dev/null +++ b/models/sdkerrors/getuserfriends.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type GetUserFriendsPlexErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetUserFriendsPlexErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetUserFriendsPlexErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetUserFriendsPlexErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetUserFriendsPlexResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetUserFriendsPlexResponseBody struct { + Errors []GetUserFriendsPlexErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetUserFriendsPlexResponseBody{} + +func (e *GetUserFriendsPlexResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetUserFriendsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetUserFriendsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetUserFriendsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetUserFriendsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetUserFriendsResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetUserFriendsResponseBody struct { + Errors []GetUserFriendsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetUserFriendsResponseBody{} + +func (e *GetUserFriendsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/getwatchlist.go b/models/sdkerrors/getwatchlist.go index 2565872..45fe0bb 100644 --- a/models/sdkerrors/getwatchlist.go +++ b/models/sdkerrors/getwatchlist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,43 +7,84 @@ import ( "net/http" ) -type GetWatchlistErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type GetWatchListWatchlistErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *GetWatchlistErrors) GetCode() *float64 { +func (o *GetWatchListWatchlistErrors) GetCode() *int64 { if o == nil { return nil } return o.Code } -func (o *GetWatchlistErrors) GetMessage() *string { +func (o *GetWatchListWatchlistErrors) GetMessage() *string { if o == nil { return nil } return o.Message } -func (o *GetWatchlistErrors) GetStatus() *float64 { +func (o *GetWatchListWatchlistErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// GetWatchlistResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. -type GetWatchlistResponseBody struct { - Errors []GetWatchlistErrors `json:"errors,omitempty"` +// GetWatchListWatchlistResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type GetWatchListWatchlistResponseBody struct { + Errors []GetWatchListWatchlistErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing RawResponse *http.Response `json:"-"` } -var _ error = &GetWatchlistResponseBody{} +var _ error = &GetWatchListWatchlistResponseBody{} -func (e *GetWatchlistResponseBody) Error() string { +func (e *GetWatchListWatchlistResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type GetWatchListErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *GetWatchListErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *GetWatchListErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *GetWatchListErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// GetWatchListResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type GetWatchListResponseBody struct { + Errors []GetWatchListErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &GetWatchListResponseBody{} + +func (e *GetWatchListResponseBody) Error() string { data, _ := json.Marshal(e) return string(data) } diff --git a/models/sdkerrors/logline.go b/models/sdkerrors/logline.go index 0dd1060..c8c8fdd 100644 --- a/models/sdkerrors/logline.go +++ b/models/sdkerrors/logline.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type LogLineErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type LogLineLogErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *LogLineErrors) GetCode() *float64 { +func (o *LogLineLogErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *LogLineLogErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *LogLineLogErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// LogLineLogResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type LogLineLogResponseBody struct { + Errors []LogLineLogErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &LogLineLogResponseBody{} + +func (e *LogLineLogResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type LogLineErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *LogLineErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *LogLineErrors) GetMessage() *string { return o.Message } -func (o *LogLineErrors) GetStatus() *float64 { +func (o *LogLineErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// LogLineResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// LogLineResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type LogLineResponseBody struct { Errors []LogLineErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/logmultiline.go b/models/sdkerrors/logmultiline.go index 4fa1e71..5a4fd50 100644 --- a/models/sdkerrors/logmultiline.go +++ b/models/sdkerrors/logmultiline.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type LogMultiLineErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type LogMultiLineLogErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *LogMultiLineErrors) GetCode() *float64 { +func (o *LogMultiLineLogErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *LogMultiLineLogErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *LogMultiLineLogErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// LogMultiLineLogResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type LogMultiLineLogResponseBody struct { + Errors []LogMultiLineLogErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &LogMultiLineLogResponseBody{} + +func (e *LogMultiLineLogResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type LogMultiLineErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *LogMultiLineErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *LogMultiLineErrors) GetMessage() *string { return o.Message } -func (o *LogMultiLineErrors) GetStatus() *float64 { +func (o *LogMultiLineErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// LogMultiLineResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// LogMultiLineResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type LogMultiLineResponseBody struct { Errors []LogMultiLineErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/markplayed.go b/models/sdkerrors/markplayed.go index a740882..008dab7 100644 --- a/models/sdkerrors/markplayed.go +++ b/models/sdkerrors/markplayed.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type MarkPlayedErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type MarkPlayedMediaErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *MarkPlayedErrors) GetCode() *float64 { +func (o *MarkPlayedMediaErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *MarkPlayedMediaErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *MarkPlayedMediaErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// MarkPlayedMediaResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type MarkPlayedMediaResponseBody struct { + Errors []MarkPlayedMediaErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &MarkPlayedMediaResponseBody{} + +func (e *MarkPlayedMediaResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type MarkPlayedErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *MarkPlayedErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *MarkPlayedErrors) GetMessage() *string { return o.Message } -func (o *MarkPlayedErrors) GetStatus() *float64 { +func (o *MarkPlayedErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// MarkPlayedResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// MarkPlayedResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type MarkPlayedResponseBody struct { Errors []MarkPlayedErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/markunplayed.go b/models/sdkerrors/markunplayed.go index bf79cc1..7bbfce3 100644 --- a/models/sdkerrors/markunplayed.go +++ b/models/sdkerrors/markunplayed.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type MarkUnplayedErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type MarkUnplayedMediaErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *MarkUnplayedErrors) GetCode() *float64 { +func (o *MarkUnplayedMediaErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *MarkUnplayedMediaErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *MarkUnplayedMediaErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// MarkUnplayedMediaResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type MarkUnplayedMediaResponseBody struct { + Errors []MarkUnplayedMediaErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &MarkUnplayedMediaResponseBody{} + +func (e *MarkUnplayedMediaResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type MarkUnplayedErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *MarkUnplayedErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *MarkUnplayedErrors) GetMessage() *string { return o.Message } -func (o *MarkUnplayedErrors) GetStatus() *float64 { +func (o *MarkUnplayedErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// MarkUnplayedResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// MarkUnplayedResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type MarkUnplayedResponseBody struct { Errors []MarkUnplayedErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/performsearch.go b/models/sdkerrors/performsearch.go index 38a5330..3221249 100644 --- a/models/sdkerrors/performsearch.go +++ b/models/sdkerrors/performsearch.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type PerformSearchErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type PerformSearchSearchErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *PerformSearchErrors) GetCode() *float64 { +func (o *PerformSearchSearchErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *PerformSearchSearchErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *PerformSearchSearchErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// PerformSearchSearchResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type PerformSearchSearchResponseBody struct { + Errors []PerformSearchSearchErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &PerformSearchSearchResponseBody{} + +func (e *PerformSearchSearchResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type PerformSearchErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *PerformSearchErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *PerformSearchErrors) GetMessage() *string { return o.Message } -func (o *PerformSearchErrors) GetStatus() *float64 { +func (o *PerformSearchErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// PerformSearchResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// PerformSearchResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type PerformSearchResponseBody struct { Errors []PerformSearchErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/performvoicesearch.go b/models/sdkerrors/performvoicesearch.go index ce42ad4..920cb96 100644 --- a/models/sdkerrors/performvoicesearch.go +++ b/models/sdkerrors/performvoicesearch.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type PerformVoiceSearchErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type PerformVoiceSearchSearchErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *PerformVoiceSearchErrors) GetCode() *float64 { +func (o *PerformVoiceSearchSearchErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *PerformVoiceSearchSearchErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *PerformVoiceSearchSearchErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// PerformVoiceSearchSearchResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type PerformVoiceSearchSearchResponseBody struct { + Errors []PerformVoiceSearchSearchErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &PerformVoiceSearchSearchResponseBody{} + +func (e *PerformVoiceSearchSearchResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type PerformVoiceSearchErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *PerformVoiceSearchErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *PerformVoiceSearchErrors) GetMessage() *string { return o.Message } -func (o *PerformVoiceSearchErrors) GetStatus() *float64 { +func (o *PerformVoiceSearchErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// PerformVoiceSearchResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// PerformVoiceSearchResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type PerformVoiceSearchResponseBody struct { Errors []PerformVoiceSearchErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/postuserssignindata.go b/models/sdkerrors/postuserssignindata.go new file mode 100644 index 0000000..6a8bd05 --- /dev/null +++ b/models/sdkerrors/postuserssignindata.go @@ -0,0 +1,90 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "net/http" +) + +type PostUsersSignInDataAuthenticationErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *PostUsersSignInDataAuthenticationErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *PostUsersSignInDataAuthenticationErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *PostUsersSignInDataAuthenticationErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// PostUsersSignInDataAuthenticationResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type PostUsersSignInDataAuthenticationResponseBody struct { + Errors []PostUsersSignInDataAuthenticationErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &PostUsersSignInDataAuthenticationResponseBody{} + +func (e *PostUsersSignInDataAuthenticationResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type PostUsersSignInDataErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *PostUsersSignInDataErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *PostUsersSignInDataErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *PostUsersSignInDataErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// PostUsersSignInDataResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. +type PostUsersSignInDataResponseBody struct { + Errors []PostUsersSignInDataErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &PostUsersSignInDataResponseBody{} + +func (e *PostUsersSignInDataResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} diff --git a/models/sdkerrors/refreshlibrary.go b/models/sdkerrors/refreshlibrary.go deleted file mode 100644 index a642757..0000000 --- a/models/sdkerrors/refreshlibrary.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package sdkerrors - -import ( - "encoding/json" - "net/http" -) - -type RefreshLibraryErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` -} - -func (o *RefreshLibraryErrors) GetCode() *float64 { - if o == nil { - return nil - } - return o.Code -} - -func (o *RefreshLibraryErrors) GetMessage() *string { - if o == nil { - return nil - } - return o.Message -} - -func (o *RefreshLibraryErrors) GetStatus() *float64 { - if o == nil { - return nil - } - return o.Status -} - -// RefreshLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. -type RefreshLibraryResponseBody struct { - Errors []RefreshLibraryErrors `json:"errors,omitempty"` - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response `json:"-"` -} - -var _ error = &RefreshLibraryResponseBody{} - -func (e *RefreshLibraryResponseBody) Error() string { - data, _ := json.Marshal(e) - return string(data) -} diff --git a/models/sdkerrors/sdkerror.go b/models/sdkerrors/sdkerror.go index 5c1affd..7d63b98 100644 --- a/models/sdkerrors/sdkerror.go +++ b/models/sdkerrors/sdkerror.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors diff --git a/models/sdkerrors/searchlibrary.go b/models/sdkerrors/searchlibrary.go deleted file mode 100644 index 9c2d782..0000000 --- a/models/sdkerrors/searchlibrary.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. - -package sdkerrors - -import ( - "encoding/json" - "net/http" -) - -type SearchLibraryErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` -} - -func (o *SearchLibraryErrors) GetCode() *float64 { - if o == nil { - return nil - } - return o.Code -} - -func (o *SearchLibraryErrors) GetMessage() *string { - if o == nil { - return nil - } - return o.Message -} - -func (o *SearchLibraryErrors) GetStatus() *float64 { - if o == nil { - return nil - } - return o.Status -} - -// SearchLibraryResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. -type SearchLibraryResponseBody struct { - Errors []SearchLibraryErrors `json:"errors,omitempty"` - // Raw HTTP response; suitable for custom response parsing - RawResponse *http.Response `json:"-"` -} - -var _ error = &SearchLibraryResponseBody{} - -func (e *SearchLibraryResponseBody) Error() string { - data, _ := json.Marshal(e) - return string(data) -} diff --git a/models/sdkerrors/startalltasks.go b/models/sdkerrors/startalltasks.go index c88bf25..edf9973 100644 --- a/models/sdkerrors/startalltasks.go +++ b/models/sdkerrors/startalltasks.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type StartAllTasksErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type StartAllTasksButlerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *StartAllTasksErrors) GetCode() *float64 { +func (o *StartAllTasksButlerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *StartAllTasksButlerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *StartAllTasksButlerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// StartAllTasksButlerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type StartAllTasksButlerResponseBody struct { + Errors []StartAllTasksButlerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &StartAllTasksButlerResponseBody{} + +func (e *StartAllTasksButlerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type StartAllTasksErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *StartAllTasksErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *StartAllTasksErrors) GetMessage() *string { return o.Message } -func (o *StartAllTasksErrors) GetStatus() *float64 { +func (o *StartAllTasksErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// StartAllTasksResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// StartAllTasksResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type StartAllTasksResponseBody struct { Errors []StartAllTasksErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/starttask.go b/models/sdkerrors/starttask.go index 8031725..34d2d7f 100644 --- a/models/sdkerrors/starttask.go +++ b/models/sdkerrors/starttask.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type StartTaskErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type StartTaskButlerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *StartTaskErrors) GetCode() *float64 { +func (o *StartTaskButlerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *StartTaskButlerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *StartTaskButlerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// StartTaskButlerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type StartTaskButlerResponseBody struct { + Errors []StartTaskButlerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &StartTaskButlerResponseBody{} + +func (e *StartTaskButlerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type StartTaskErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *StartTaskErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *StartTaskErrors) GetMessage() *string { return o.Message } -func (o *StartTaskErrors) GetStatus() *float64 { +func (o *StartTaskErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// StartTaskResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// StartTaskResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type StartTaskResponseBody struct { Errors []StartTaskErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/startuniversaltranscode.go b/models/sdkerrors/startuniversaltranscode.go index 68ef2a5..13c4cec 100644 --- a/models/sdkerrors/startuniversaltranscode.go +++ b/models/sdkerrors/startuniversaltranscode.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type StartUniversalTranscodeErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type StartUniversalTranscodeVideoErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *StartUniversalTranscodeErrors) GetCode() *float64 { +func (o *StartUniversalTranscodeVideoErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *StartUniversalTranscodeVideoErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *StartUniversalTranscodeVideoErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// StartUniversalTranscodeVideoResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type StartUniversalTranscodeVideoResponseBody struct { + Errors []StartUniversalTranscodeVideoErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &StartUniversalTranscodeVideoResponseBody{} + +func (e *StartUniversalTranscodeVideoResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type StartUniversalTranscodeErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *StartUniversalTranscodeErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *StartUniversalTranscodeErrors) GetMessage() *string { return o.Message } -func (o *StartUniversalTranscodeErrors) GetStatus() *float64 { +func (o *StartUniversalTranscodeErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// StartUniversalTranscodeResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// StartUniversalTranscodeResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type StartUniversalTranscodeResponseBody struct { Errors []StartUniversalTranscodeErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/stopalltasks.go b/models/sdkerrors/stopalltasks.go index 700d86b..3b51275 100644 --- a/models/sdkerrors/stopalltasks.go +++ b/models/sdkerrors/stopalltasks.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type StopAllTasksErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type StopAllTasksButlerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *StopAllTasksErrors) GetCode() *float64 { +func (o *StopAllTasksButlerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *StopAllTasksButlerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *StopAllTasksButlerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// StopAllTasksButlerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type StopAllTasksButlerResponseBody struct { + Errors []StopAllTasksButlerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &StopAllTasksButlerResponseBody{} + +func (e *StopAllTasksButlerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type StopAllTasksErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *StopAllTasksErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *StopAllTasksErrors) GetMessage() *string { return o.Message } -func (o *StopAllTasksErrors) GetStatus() *float64 { +func (o *StopAllTasksErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// StopAllTasksResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// StopAllTasksResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type StopAllTasksResponseBody struct { Errors []StopAllTasksErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/stoptask.go b/models/sdkerrors/stoptask.go index ceb6d84..98a7ce6 100644 --- a/models/sdkerrors/stoptask.go +++ b/models/sdkerrors/stoptask.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type StopTaskErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type StopTaskButlerErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *StopTaskErrors) GetCode() *float64 { +func (o *StopTaskButlerErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *StopTaskButlerErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *StopTaskButlerErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// StopTaskButlerResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type StopTaskButlerResponseBody struct { + Errors []StopTaskButlerErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &StopTaskButlerResponseBody{} + +func (e *StopTaskButlerResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type StopTaskErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *StopTaskErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *StopTaskErrors) GetMessage() *string { return o.Message } -func (o *StopTaskErrors) GetStatus() *float64 { +func (o *StopTaskErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// StopTaskResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// StopTaskResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type StopTaskResponseBody struct { Errors []StopTaskErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/stoptranscodesession.go b/models/sdkerrors/stoptranscodesession.go index a243a03..99ad617 100644 --- a/models/sdkerrors/stoptranscodesession.go +++ b/models/sdkerrors/stoptranscodesession.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type StopTranscodeSessionErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type StopTranscodeSessionSessionsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *StopTranscodeSessionErrors) GetCode() *float64 { +func (o *StopTranscodeSessionSessionsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *StopTranscodeSessionSessionsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *StopTranscodeSessionSessionsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// StopTranscodeSessionSessionsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type StopTranscodeSessionSessionsResponseBody struct { + Errors []StopTranscodeSessionSessionsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &StopTranscodeSessionSessionsResponseBody{} + +func (e *StopTranscodeSessionSessionsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type StopTranscodeSessionErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *StopTranscodeSessionErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *StopTranscodeSessionErrors) GetMessage() *string { return o.Message } -func (o *StopTranscodeSessionErrors) GetStatus() *float64 { +func (o *StopTranscodeSessionErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// StopTranscodeSessionResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// StopTranscodeSessionResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type StopTranscodeSessionResponseBody struct { Errors []StopTranscodeSessionErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/updateplaylist.go b/models/sdkerrors/updateplaylist.go index 103cbfc..b50e5b0 100644 --- a/models/sdkerrors/updateplaylist.go +++ b/models/sdkerrors/updateplaylist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type UpdatePlaylistErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type UpdatePlaylistPlaylistsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *UpdatePlaylistErrors) GetCode() *float64 { +func (o *UpdatePlaylistPlaylistsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *UpdatePlaylistPlaylistsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *UpdatePlaylistPlaylistsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// UpdatePlaylistPlaylistsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type UpdatePlaylistPlaylistsResponseBody struct { + Errors []UpdatePlaylistPlaylistsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &UpdatePlaylistPlaylistsResponseBody{} + +func (e *UpdatePlaylistPlaylistsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type UpdatePlaylistErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *UpdatePlaylistErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *UpdatePlaylistErrors) GetMessage() *string { return o.Message } -func (o *UpdatePlaylistErrors) GetStatus() *float64 { +func (o *UpdatePlaylistErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// UpdatePlaylistResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// UpdatePlaylistResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type UpdatePlaylistResponseBody struct { Errors []UpdatePlaylistErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/updateplayprogress.go b/models/sdkerrors/updateplayprogress.go index fd08fce..98683df 100644 --- a/models/sdkerrors/updateplayprogress.go +++ b/models/sdkerrors/updateplayprogress.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type UpdatePlayProgressErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type UpdatePlayProgressMediaErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *UpdatePlayProgressErrors) GetCode() *float64 { +func (o *UpdatePlayProgressMediaErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *UpdatePlayProgressMediaErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *UpdatePlayProgressMediaErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// UpdatePlayProgressMediaResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type UpdatePlayProgressMediaResponseBody struct { + Errors []UpdatePlayProgressMediaErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &UpdatePlayProgressMediaResponseBody{} + +func (e *UpdatePlayProgressMediaResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type UpdatePlayProgressErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *UpdatePlayProgressErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *UpdatePlayProgressErrors) GetMessage() *string { return o.Message } -func (o *UpdatePlayProgressErrors) GetStatus() *float64 { +func (o *UpdatePlayProgressErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// UpdatePlayProgressResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// UpdatePlayProgressResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type UpdatePlayProgressResponseBody struct { Errors []UpdatePlayProgressErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/models/sdkerrors/uploadplaylist.go b/models/sdkerrors/uploadplaylist.go index cfc6165..f97c495 100644 --- a/models/sdkerrors/uploadplaylist.go +++ b/models/sdkerrors/uploadplaylist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package sdkerrors @@ -7,13 +7,54 @@ import ( "net/http" ) -type UploadPlaylistErrors struct { - Code *float64 `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Status *float64 `json:"status,omitempty"` +type UploadPlaylistPlaylistsErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` } -func (o *UploadPlaylistErrors) GetCode() *float64 { +func (o *UploadPlaylistPlaylistsErrors) GetCode() *int64 { + if o == nil { + return nil + } + return o.Code +} + +func (o *UploadPlaylistPlaylistsErrors) GetMessage() *string { + if o == nil { + return nil + } + return o.Message +} + +func (o *UploadPlaylistPlaylistsErrors) GetStatus() *int64 { + if o == nil { + return nil + } + return o.Status +} + +// UploadPlaylistPlaylistsResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +type UploadPlaylistPlaylistsResponseBody struct { + Errors []UploadPlaylistPlaylistsErrors `json:"errors,omitempty"` + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response `json:"-"` +} + +var _ error = &UploadPlaylistPlaylistsResponseBody{} + +func (e *UploadPlaylistPlaylistsResponseBody) Error() string { + data, _ := json.Marshal(e) + return string(data) +} + +type UploadPlaylistErrors struct { + Code *int64 `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Status *int64 `json:"status,omitempty"` +} + +func (o *UploadPlaylistErrors) GetCode() *int64 { if o == nil { return nil } @@ -27,14 +68,14 @@ func (o *UploadPlaylistErrors) GetMessage() *string { return o.Message } -func (o *UploadPlaylistErrors) GetStatus() *float64 { +func (o *UploadPlaylistErrors) GetStatus() *int64 { if o == nil { return nil } return o.Status } -// UploadPlaylistResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. +// UploadPlaylistResponseBody - Bad Request - A parameter was not specified, or was specified incorrectly. type UploadPlaylistResponseBody struct { Errors []UploadPlaylistErrors `json:"errors,omitempty"` // Raw HTTP response; suitable for custom response parsing diff --git a/playlists.go b/playlists.go index 36da59d..5bfd7a6 100644 --- a/playlists.go +++ b/playlists.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -33,7 +34,7 @@ func newPlaylists(sdkConfig sdkConfiguration) *Playlists { // Create a new playlist. By default the playlist is blank. To create a playlist along with a first item, pass: // - `uri` - The content URI for what we're playing (e.g. `server://1234/com.plexapp.plugins.library/library/metadata/1`). // - `playQueueID` - To create a playlist from an existing play queue. -func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.CreatePlaylistRequest) (*operations.CreatePlaylistResponse, error) { +func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.CreatePlaylistRequest, opts ...operations.Option) (*operations.CreatePlaylistResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "createPlaylist", @@ -41,12 +42,35 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/playlists") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -62,33 +86,89 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.CreatePlaylistResponse{ @@ -97,17 +177,25 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.CreatePlaylistResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -115,17 +203,21 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.CreatePlaylistResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -134,9 +226,51 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.CreatePlaylistPlaylistsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -146,7 +280,7 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat // GetPlaylists - Get All Playlists // Get All Playlists given the specified filters. -func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.PlaylistType, smart *operations.QueryParamSmart) (*operations.GetPlaylistsResponse, error) { +func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.PlaylistType, smart *operations.QueryParamSmart, opts ...operations.Option) (*operations.GetPlaylistsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getPlaylists", @@ -159,12 +293,35 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P Smart: smart, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/playlists") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -180,33 +337,89 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetPlaylistsResponse{ @@ -215,17 +428,25 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetPlaylistsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -233,17 +454,21 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetPlaylistsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -252,9 +477,51 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetPlaylistsPlaylistsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -265,7 +532,7 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P // GetPlaylist - Retrieve Playlist // Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item: // Smart playlist details contain the `content` attribute. This is the content URI for the generator. This can then be parsed by a client to provide smart playlist editing. -func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64) (*operations.GetPlaylistResponse, error) { +func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64, opts ...operations.Option) (*operations.GetPlaylistResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getPlaylist", @@ -277,12 +544,35 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64) (*opera PlaylistID: playlistID, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -294,33 +584,89 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64) (*opera return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetPlaylistResponse{ @@ -329,17 +675,25 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64) (*opera RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetPlaylistResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -347,17 +701,21 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64) (*opera res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetPlaylistResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -366,9 +724,51 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64) (*opera out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetPlaylistPlaylistsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -378,7 +778,7 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64) (*opera // DeletePlaylist - Deletes a Playlist // This endpoint will delete a playlist -func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64) (*operations.DeletePlaylistResponse, error) { +func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64, opts ...operations.Option) (*operations.DeletePlaylistResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "deletePlaylist", @@ -390,12 +790,35 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64) (*op PlaylistID: playlistID, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -407,33 +830,89 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64) (*op return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.DeletePlaylistResponse{ @@ -442,24 +921,26 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64) (*op RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 204: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.DeletePlaylistResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -468,9 +949,51 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64) (*op out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.DeletePlaylistPlaylistsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -480,7 +1003,7 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64) (*op // UpdatePlaylist - Update a Playlist // From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}` -func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, title *string, summary *string) (*operations.UpdatePlaylistResponse, error) { +func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, title *string, summary *string, opts ...operations.Option) (*operations.UpdatePlaylistResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "updatePlaylist", @@ -494,12 +1017,35 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, titl Summary: summary, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -515,33 +1061,89 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, titl return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.UpdatePlaylistResponse{ @@ -550,24 +1152,26 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, titl RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.UpdatePlaylistResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -576,9 +1180,51 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, titl out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.UpdatePlaylistPlaylistsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -591,7 +1237,7 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, titl // By default leaves are returned (e.g. episodes, movies). In order to return other types you can use the `type` parameter. // For example, you could use this to display a list of recently added albums vis a smart playlist. // Note that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items. -func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, type_ float64) (*operations.GetPlaylistContentsResponse, error) { +func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, type_ operations.GetPlaylistContentsQueryParamType, opts ...operations.Option) (*operations.GetPlaylistContentsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getPlaylistContents", @@ -604,12 +1250,35 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, Type: type_, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}/items", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -625,33 +1294,89 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetPlaylistContentsResponse{ @@ -660,17 +1385,25 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetPlaylistContentsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -678,17 +1411,21 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetPlaylistContentsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -697,9 +1434,51 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetPlaylistContentsPlaylistsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -709,7 +1488,7 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, // ClearPlaylistContents - Delete Playlist Contents // Clears a playlist, only works with dumb playlists. Returns the playlist. -func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float64) (*operations.ClearPlaylistContentsResponse, error) { +func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float64, opts ...operations.Option) (*operations.ClearPlaylistContentsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "clearPlaylistContents", @@ -721,12 +1500,35 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float6 PlaylistID: playlistID, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}/items", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -738,33 +1540,89 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float6 return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.ClearPlaylistContentsResponse{ @@ -773,24 +1631,26 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float6 RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ClearPlaylistContentsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -799,9 +1659,51 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float6 out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.ClearPlaylistContentsPlaylistsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -812,7 +1714,7 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float6 // AddPlaylistContents - Adding to a Playlist // Adds a generator to a playlist, same parameters as the POST to create. With a dumb playlist, this adds the specified items to the playlist. // With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist. -func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, uri string, playQueueID *float64) (*operations.AddPlaylistContentsResponse, error) { +func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, uri string, playQueueID *float64, opts ...operations.Option) (*operations.AddPlaylistContentsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "addPlaylistContents", @@ -826,12 +1728,35 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, PlayQueueID: playQueueID, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/playlists/{playlistID}/items", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -847,33 +1772,89 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.AddPlaylistContentsResponse{ @@ -882,17 +1863,25 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.AddPlaylistContentsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -900,17 +1889,21 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.AddPlaylistContentsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -919,9 +1912,51 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.AddPlaylistContentsPlaylistsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -931,7 +1966,7 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, // UploadPlaylist - Upload Playlist // Imports m3u playlists by passing a path on the server to scan for m3u-formatted playlist files, or a path to a single playlist file. -func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force operations.Force) (*operations.UploadPlaylistResponse, error) { +func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force operations.QueryParamForce, opts ...operations.Option) (*operations.UploadPlaylistResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "uploadPlaylist", @@ -944,12 +1979,35 @@ func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force opera Force: force, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/playlists/upload") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -965,33 +2023,89 @@ func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force opera return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.UploadPlaylistResponse{ @@ -1000,24 +2114,26 @@ func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force opera RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.UploadPlaylistResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -1026,9 +2142,51 @@ func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force opera out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.UploadPlaylistPlaylistsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/plex.go b/plex.go index 5214a89..908e978 100644 --- a/plex.go +++ b/plex.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -26,22 +27,50 @@ func newPlex(sdkConfig sdkConfiguration) *Plex { } } -// GetHomeData - Get Plex Home Data -// Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status. -func (s *Plex) GetHomeData(ctx context.Context) (*operations.GetHomeDataResponse, error) { +// GetCompanionsData - Get Companions Data +// Get Companions Data +func (s *Plex) GetCompanionsData(ctx context.Context, opts ...operations.Option) (*operations.GetCompanionsDataResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "getHomeData", + OperationID: "getCompanionsData", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/home") + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionServerURL, + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(operations.GetCompanionsDataServerList[0], map[string]string{}) + if o.ServerURL != nil { + baseURL = *o.ServerURL + } + + opURL, err := url.JoinPath(baseURL, "/companions") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -53,33 +82,821 @@ func (s *Plex) GetHomeData(ctx context.Context) (*operations.GetHomeDataResponse return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetCompanionsDataResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out []operations.ResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.ResponseBodies = out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetCompanionsDataResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetCompanionsDataPlexResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetUserFriends - Get list of friends of the user logged in +// Get friends of provided auth token. +func (s *Plex) GetUserFriends(ctx context.Context, opts ...operations.Option) (*operations.GetUserFriendsResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getUserFriends", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionServerURL, + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(operations.GetUserFriendsServerList[0], map[string]string{}) + if o.ServerURL != nil { + baseURL = *o.ServerURL + } + + opURL, err := url.JoinPath(baseURL, "/friends") if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetUserFriendsResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out []operations.Friend + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Friends = out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetUserFriendsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetUserFriendsPlexResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetGeoData - Get Geo Data +// Returns the geolocation and locale data of the caller +func (s *Plex) GetGeoData(ctx context.Context, opts ...operations.Option) (*operations.GetGeoDataResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getGeoData", + OAuth2Scopes: []string{}, + SecuritySource: nil, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionServerURL, + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(operations.GetGeoDataServerList[0], map[string]string{}) + if o.ServerURL != nil { + baseURL = *o.ServerURL + } + + opURL, err := url.JoinPath(baseURL, "/geoip") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetGeoDataResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetGeoDataGeoData + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.GeoData = &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetGeoDataResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetGeoDataPlexResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetHomeData - Get Plex Home Data +// Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status. +func (s *Plex) GetHomeData(ctx context.Context, opts ...operations.Option) (*operations.GetHomeDataResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getHomeData", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := url.JoinPath(baseURL, "/home") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetHomeDataResponse{ @@ -88,17 +905,25 @@ func (s *Plex) GetHomeData(ctx context.Context) (*operations.GetHomeDataResponse RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetHomeDataResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -106,17 +931,21 @@ func (s *Plex) GetHomeData(ctx context.Context) (*operations.GetHomeDataResponse res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetHomeDataResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -125,9 +954,306 @@ func (s *Plex) GetHomeData(ctx context.Context) (*operations.GetHomeDataResponse out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetHomeDataPlexResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetServerResources - Get Server Resources +// Get Plex server access tokens and server connections +func (s *Plex) GetServerResources(ctx context.Context, request operations.GetServerResourcesRequest, opts ...operations.Option) (*operations.GetServerResourcesResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-server-resources", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + globals := operations.GetServerResourcesGlobals{ + XPlexClientIdentifier: s.sdkConfiguration.Globals.XPlexClientIdentifier, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionServerURL, + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(operations.GetServerResourcesServerList[0], map[string]string{}) + if o.ServerURL != nil { + baseURL = *o.ServerURL + } + + opURL, err := url.JoinPath(baseURL, "/resources") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, globals); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetServerResourcesResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out []operations.PlexDevice + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.PlexDevices = out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetServerResourcesResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetServerResourcesPlexResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -137,7 +1263,7 @@ func (s *Plex) GetHomeData(ctx context.Context) (*operations.GetHomeDataResponse // GetPin - Get a Pin // Retrieve a Pin from Plex.tv for authentication flows -func (s *Plex) GetPin(ctx context.Context, xPlexProduct string, strong *bool, xPlexClientIdentifier *string, opts ...operations.Option) (*operations.GetPinResponse, error) { +func (s *Plex) GetPin(ctx context.Context, strong *bool, xPlexClientIdentifier *string, xPlexProduct *string, opts ...operations.Option) (*operations.GetPinResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getPin", @@ -158,6 +1284,8 @@ func (s *Plex) GetPin(ctx context.Context, xPlexProduct string, strong *bool, xP o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionServerURL, + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -165,16 +1293,28 @@ func (s *Plex) GetPin(ctx context.Context, xPlexProduct string, strong *bool, xP return nil, fmt.Errorf("error applying option: %w", err) } } + baseURL := utils.ReplaceParameters(operations.GetPinServerList[0], map[string]string{}) if o.ServerURL != nil { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/pins", request, globals) + opURL, err := url.JoinPath(baseURL, "/pins") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "POST", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -182,39 +1322,93 @@ func (s *Plex) GetPin(ctx context.Context, xPlexProduct string, strong *bool, xP req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - utils.PopulateHeaders(ctx, req, request, globals) - if err := utils.PopulateQueryParams(ctx, req, request, globals); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetPinResponse{ @@ -223,29 +1417,47 @@ func (s *Plex) GetPin(ctx context.Context, xPlexProduct string, strong *bool, xP RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { - case httpRes.StatusCode == 201: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out operations.GetPinResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetPinAuthPinContainer if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Object = &out + res.AuthPinContainer = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetPinResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -254,13 +1466,28 @@ func (s *Plex) GetPin(ctx context.Context, xPlexProduct string, strong *bool, xP out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -268,28 +1495,30 @@ func (s *Plex) GetPin(ctx context.Context, xPlexProduct string, strong *bool, xP } -// GetToken - Get Access Token -// Retrieve an Access Token from Plex.tv after the Pin has already been authenticated -func (s *Plex) GetToken(ctx context.Context, pinID string, xPlexClientIdentifier *string, opts ...operations.Option) (*operations.GetTokenResponse, error) { +// GetTokenByPinID - Get Access Token by PinId +// Retrieve an Access Token from Plex.tv after the Pin has been authenticated +func (s *Plex) GetTokenByPinID(ctx context.Context, pinID int64, xPlexClientIdentifier *string, opts ...operations.Option) (*operations.GetTokenByPinIDResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "getToken", + OperationID: "getTokenByPinId", OAuth2Scopes: []string{}, SecuritySource: nil, } - request := operations.GetTokenRequest{ - PinID: pinID, + request := operations.GetTokenByPinIDRequest{ XPlexClientIdentifier: xPlexClientIdentifier, + PinID: pinID, } - globals := operations.GetTokenGlobals{ + globals := operations.GetTokenByPinIDGlobals{ XPlexClientIdentifier: s.sdkConfiguration.Globals.XPlexClientIdentifier, } o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionServerURL, + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -297,7 +1526,8 @@ func (s *Plex) GetToken(ctx context.Context, pinID string, xPlexClientIdentifier return nil, fmt.Errorf("error applying option: %w", err) } } - baseURL := utils.ReplaceParameters(operations.GetTokenServerList[0], map[string]string{}) + + baseURL := utils.ReplaceParameters(operations.GetTokenByPinIDServerList[0], map[string]string{}) if o.ServerURL != nil { baseURL = *o.ServerURL } @@ -307,6 +1537,17 @@ func (s *Plex) GetToken(ctx context.Context, pinID string, xPlexClientIdentifier return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -314,71 +1555,143 @@ func (s *Plex) GetToken(ctx context.Context, pinID string, xPlexClientIdentifier req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - utils.PopulateHeaders(ctx, req, request, globals) - if err := utils.PopulateQueryParams(ctx, req, request, globals); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "404", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } - res := &operations.GetTokenResponse{ + res := &operations.GetTokenByPinIDResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out operations.GetTokenResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetTokenByPinIDAuthPinContainer if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.Object = &out + res.AuthPinContainer = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out sdkerrors.GetTokenResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetTokenByPinIDResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -386,13 +1699,51 @@ func (s *Plex) GetToken(ctx context.Context, pinID string, xPlexClientIdentifier out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 404: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetTokenByPinIDPlexResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/plexapi.go b/plexapi.go index 3610d2c..15b389e 100644 --- a/plexapi.go +++ b/plexapi.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +10,7 @@ import ( "github.com/LukeHagar/plexgo/internal/hooks" "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/components" + "github.com/LukeHagar/plexgo/retry" "net/http" "time" ) @@ -55,8 +56,9 @@ type sdkConfiguration struct { GenVersion string UserAgent string Globals globals.Globals - RetryConfig *utils.RetryConfig + RetryConfig *retry.Config Hooks *hooks.Hooks + Timeout *time.Duration } func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { @@ -67,8 +69,7 @@ func (c *sdkConfiguration) GetServerDetails() (string, map[string]string) { return ServerList[c.ServerIndex], c.ServerDefaults[c.ServerIndex] } -// PlexAPI - Plex-API: A Plex Media Server API Map -// An Open API Spec for interacting with Plex.tv and Plex Servers +// PlexAPI - Plex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server type PlexAPI struct { // Operations against the Plex Media Server System. // @@ -103,6 +104,9 @@ type PlexAPI struct { // API Calls interacting with Plex Media Server Libraries // Library *Library + // API Calls that perform operations with Plex Media Server Watchlists + // + Watchlist *Watchlist // Submit logs to the Log Handler for Plex Media Server // Log *Log @@ -125,9 +129,6 @@ type PlexAPI struct { // Updates to the status can be observed via the Event API. // Updater *Updater - // API Calls that perform operations with Plex Media Server Watchlists - // - Watchlist *Watchlist sdkConfiguration sdkConfiguration } @@ -163,6 +164,7 @@ func WithServerIndex(serverIndex int) SDKOption { } } +// ServerProtocol - The protocol to use for the server connection type ServerProtocol string const ( @@ -238,7 +240,7 @@ func WithClient(client HTTPClient) SDKOption { // WithSecurity configures the SDK to use the provided security details func WithSecurity(accessToken string) SDKOption { return func(sdk *PlexAPI) { - security := components.Security{AccessToken: accessToken} + security := components.Security{AccessToken: &accessToken} sdk.sdkConfiguration.Security = utils.AsSecuritySource(&security) } } @@ -259,25 +261,32 @@ func WithXPlexClientIdentifier(xPlexClientIdentifier string) SDKOption { } } -func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption { +func WithRetryConfig(retryConfig retry.Config) SDKOption { return func(sdk *PlexAPI) { sdk.sdkConfiguration.RetryConfig = &retryConfig } } +// WithTimeout Optional request timeout applied to each operation +func WithTimeout(timeout time.Duration) SDKOption { + return func(sdk *PlexAPI) { + sdk.sdkConfiguration.Timeout = &timeout + } +} + // New creates a new instance of the SDK with the provided options func New(opts ...SDKOption) *PlexAPI { sdk := &PlexAPI{ sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "0.0.3", - SDKVersion: "0.10.1", - GenVersion: "2.356.0", - UserAgent: "speakeasy-sdk/go 0.10.1 2.356.0 0.0.3 github.com/LukeHagar/plexgo", + SDKVersion: "0.11.0", + GenVersion: "2.413.0", + UserAgent: "speakeasy-sdk/go 0.11.0 2.413.0 0.0.3 github.com/LukeHagar/plexgo", Globals: globals.Globals{}, ServerDefaults: []map[string]string{ { - "protocol": "http", + "protocol": "https", "ip": "10.10.10.47", "port": "32400", }, @@ -319,6 +328,8 @@ func New(opts ...SDKOption) *PlexAPI { sdk.Library = newLibrary(sdk.sdkConfiguration) + sdk.Watchlist = newWatchlist(sdk.sdkConfiguration) + sdk.Log = newLog(sdk.sdkConfiguration) sdk.Playlists = newPlaylists(sdk.sdkConfiguration) @@ -331,7 +342,5 @@ func New(opts ...SDKOption) *PlexAPI { sdk.Updater = newUpdater(sdk.sdkConfiguration) - sdk.Watchlist = newWatchlist(sdk.sdkConfiguration) - return sdk } diff --git a/retry/config.go b/retry/config.go new file mode 100644 index 0000000..c051b0a --- /dev/null +++ b/retry/config.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package retry + +type BackoffStrategy struct { + InitialInterval int + MaxInterval int + Exponent float64 + MaxElapsedTime int +} + +type Config struct { + Strategy string + Backoff *BackoffStrategy + RetryConnectionErrors bool +} diff --git a/search.go b/search.go index 73a8694..c17e5a5 100644 --- a/search.go +++ b/search.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -40,7 +41,7 @@ func newSearch(sdkConfig sdkConfiguration) *Search { // - `reasonID`: The ID of the item associated with the reason for the result. This might be a section ID, a tag ID, an artist ID, or a show ID. // // This request is intended to be very fast, and called as the user types. -func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *float64, limit *float64) (*operations.PerformSearchResponse, error) { +func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *float64, limit *float64, opts ...operations.Option) (*operations.PerformSearchResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "performSearch", @@ -54,12 +55,35 @@ func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *flo Limit: limit, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/hubs/search") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -75,33 +99,89 @@ func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *flo return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.PerformSearchResponse{ @@ -110,24 +190,26 @@ func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *flo RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.PerformSearchResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -136,9 +218,51 @@ func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *flo out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.PerformSearchSearchResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -151,7 +275,7 @@ func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *flo // It uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint. // Whenever possible, clients should limit the search to the appropriate type. // Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality. -func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID *float64, limit *float64) (*operations.PerformVoiceSearchResponse, error) { +func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID *float64, limit *float64, opts ...operations.Option) (*operations.PerformVoiceSearchResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "performVoiceSearch", @@ -165,12 +289,35 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID Limit: limit, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/hubs/search/voice") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -186,33 +333,89 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.PerformVoiceSearchResponse{ @@ -221,24 +424,26 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.PerformVoiceSearchResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -247,9 +452,51 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.PerformVoiceSearchSearchResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -259,7 +506,7 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID // GetSearchResults - Get Search Results // This will search the database for the string provided. -func (s *Search) GetSearchResults(ctx context.Context, query string) (*operations.GetSearchResultsResponse, error) { +func (s *Search) GetSearchResults(ctx context.Context, query string, opts ...operations.Option) (*operations.GetSearchResultsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getSearchResults", @@ -271,12 +518,35 @@ func (s *Search) GetSearchResults(ctx context.Context, query string) (*operation Query: query, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/search") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -292,33 +562,89 @@ func (s *Search) GetSearchResults(ctx context.Context, query string) (*operation return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetSearchResultsResponse{ @@ -327,17 +653,25 @@ func (s *Search) GetSearchResults(ctx context.Context, query string) (*operation RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetSearchResultsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -345,17 +679,21 @@ func (s *Search) GetSearchResults(ctx context.Context, query string) (*operation res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetSearchResultsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -364,9 +702,51 @@ func (s *Search) GetSearchResults(ctx context.Context, query string) (*operation out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetSearchResultsSearchResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/server.go b/server.go index 5e18a03..9f4ae8d 100644 --- a/server.go +++ b/server.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -28,7 +29,7 @@ func newServer(sdkConfig sdkConfiguration) *Server { // GetServerCapabilities - Get Server Capabilities // Get Server Capabilities -func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServerCapabilitiesResponse, error) { +func (s *Server) GetServerCapabilities(ctx context.Context, opts ...operations.Option) (*operations.GetServerCapabilitiesResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getServerCapabilities", @@ -36,12 +37,35 @@ func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServ SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -53,33 +77,89 @@ func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServ return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetServerCapabilitiesResponse{ @@ -88,17 +168,25 @@ func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServ RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetServerCapabilitiesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -106,17 +194,21 @@ func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServ res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetServerCapabilitiesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -125,9 +217,51 @@ func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServ out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetServerCapabilitiesServerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -137,7 +271,7 @@ func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServ // GetServerPreferences - Get Server Preferences // Get Server Preferences -func (s *Server) GetServerPreferences(ctx context.Context) (*operations.GetServerPreferencesResponse, error) { +func (s *Server) GetServerPreferences(ctx context.Context, opts ...operations.Option) (*operations.GetServerPreferencesResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getServerPreferences", @@ -145,12 +279,35 @@ func (s *Server) GetServerPreferences(ctx context.Context) (*operations.GetServe SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/:/prefs") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -162,33 +319,89 @@ func (s *Server) GetServerPreferences(ctx context.Context) (*operations.GetServe return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetServerPreferencesResponse{ @@ -197,17 +410,25 @@ func (s *Server) GetServerPreferences(ctx context.Context) (*operations.GetServe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetServerPreferencesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -215,17 +436,21 @@ func (s *Server) GetServerPreferences(ctx context.Context) (*operations.GetServe res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetServerPreferencesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -234,9 +459,51 @@ func (s *Server) GetServerPreferences(ctx context.Context) (*operations.GetServe out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetServerPreferencesServerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -246,7 +513,7 @@ func (s *Server) GetServerPreferences(ctx context.Context) (*operations.GetServe // GetAvailableClients - Get Available Clients // Get Available Clients -func (s *Server) GetAvailableClients(ctx context.Context) (*operations.GetAvailableClientsResponse, error) { +func (s *Server) GetAvailableClients(ctx context.Context, opts ...operations.Option) (*operations.GetAvailableClientsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getAvailableClients", @@ -254,12 +521,35 @@ func (s *Server) GetAvailableClients(ctx context.Context) (*operations.GetAvaila SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/clients") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -271,33 +561,89 @@ func (s *Server) GetAvailableClients(ctx context.Context) (*operations.GetAvaila return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetAvailableClientsResponse{ @@ -306,17 +652,25 @@ func (s *Server) GetAvailableClients(ctx context.Context) (*operations.GetAvaila RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetAvailableClientsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -324,17 +678,21 @@ func (s *Server) GetAvailableClients(ctx context.Context) (*operations.GetAvaila res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetAvailableClientsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -343,9 +701,51 @@ func (s *Server) GetAvailableClients(ctx context.Context) (*operations.GetAvaila out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetAvailableClientsServerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -355,7 +755,7 @@ func (s *Server) GetAvailableClients(ctx context.Context) (*operations.GetAvaila // GetDevices - Get Devices // Get Devices -func (s *Server) GetDevices(ctx context.Context) (*operations.GetDevicesResponse, error) { +func (s *Server) GetDevices(ctx context.Context, opts ...operations.Option) (*operations.GetDevicesResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getDevices", @@ -363,12 +763,35 @@ func (s *Server) GetDevices(ctx context.Context) (*operations.GetDevicesResponse SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/devices") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -380,33 +803,89 @@ func (s *Server) GetDevices(ctx context.Context) (*operations.GetDevicesResponse return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetDevicesResponse{ @@ -415,17 +894,25 @@ func (s *Server) GetDevices(ctx context.Context) (*operations.GetDevicesResponse RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetDevicesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -433,17 +920,21 @@ func (s *Server) GetDevices(ctx context.Context) (*operations.GetDevicesResponse res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetDevicesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -452,9 +943,51 @@ func (s *Server) GetDevices(ctx context.Context) (*operations.GetDevicesResponse out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetDevicesServerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -463,13 +996,25 @@ func (s *Server) GetDevices(ctx context.Context) (*operations.GetDevicesResponse } // GetServerIdentity - Get Server Identity -// Get Server Identity -func (s *Server) GetServerIdentity(ctx context.Context) (*operations.GetServerIdentityResponse, error) { +// This request is useful to determine if the server is online or offline +func (s *Server) GetServerIdentity(ctx context.Context, opts ...operations.Option) (*operations.GetServerIdentityResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "getServerIdentity", + OperationID: "get-server-identity", OAuth2Scopes: []string{}, - SecuritySource: s.sdkConfiguration.Security, + SecuritySource: nil, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) @@ -478,6 +1023,17 @@ func (s *Server) GetServerIdentity(ctx context.Context) (*operations.GetServerId return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -485,37 +1041,89 @@ func (s *Server) GetServerIdentity(ctx context.Context) (*operations.GetServerId req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { - return nil, err - } - - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err - } - - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"408", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetServerIdentityResponse{ @@ -524,17 +1132,25 @@ func (s *Server) GetServerIdentity(ctx context.Context) (*operations.GetServerId RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetServerIdentityResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -542,17 +1158,21 @@ func (s *Server) GetServerIdentity(ctx context.Context) (*operations.GetServerId res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } - case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: + case httpRes.StatusCode == 408: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetServerIdentityResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -561,9 +1181,28 @@ func (s *Server) GetServerIdentity(ctx context.Context) (*operations.GetServerId out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -573,7 +1212,7 @@ func (s *Server) GetServerIdentity(ctx context.Context) (*operations.GetServerId // GetMyPlexAccount - Get MyPlex Account // Returns MyPlex Account Information -func (s *Server) GetMyPlexAccount(ctx context.Context) (*operations.GetMyPlexAccountResponse, error) { +func (s *Server) GetMyPlexAccount(ctx context.Context, opts ...operations.Option) (*operations.GetMyPlexAccountResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getMyPlexAccount", @@ -581,12 +1220,35 @@ func (s *Server) GetMyPlexAccount(ctx context.Context) (*operations.GetMyPlexAcc SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/myplex/account") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -598,33 +1260,89 @@ func (s *Server) GetMyPlexAccount(ctx context.Context) (*operations.GetMyPlexAcc return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetMyPlexAccountResponse{ @@ -633,17 +1351,25 @@ func (s *Server) GetMyPlexAccount(ctx context.Context) (*operations.GetMyPlexAcc RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetMyPlexAccountResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -651,17 +1377,21 @@ func (s *Server) GetMyPlexAccount(ctx context.Context) (*operations.GetMyPlexAcc res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetMyPlexAccountResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -670,9 +1400,51 @@ func (s *Server) GetMyPlexAccount(ctx context.Context) (*operations.GetMyPlexAcc out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetMyPlexAccountServerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -682,7 +1454,7 @@ func (s *Server) GetMyPlexAccount(ctx context.Context) (*operations.GetMyPlexAcc // GetResizedPhoto - Get a Resized Photo // Plex's Photo transcoder is used throughout the service to serve images at specified sizes. -func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResizedPhotoRequest) (*operations.GetResizedPhotoResponse, error) { +func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResizedPhotoRequest, opts ...operations.Option) (*operations.GetResizedPhotoResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getResizedPhoto", @@ -690,12 +1462,35 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/photo/:/transcode") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -711,33 +1506,89 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetResizedPhotoResponse{ @@ -746,24 +1597,26 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetResizedPhotoResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -772,9 +1625,301 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetResizedPhotoServerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) + } + + return res, nil + +} + +// GetMediaProviders - Get Media Providers +// Retrieves media providers and their features from the Plex server. +func (s *Server) GetMediaProviders(ctx context.Context, xPlexToken string, opts ...operations.Option) (*operations.GetMediaProvidersResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "get-media-providers", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetMediaProvidersRequest{ + XPlexToken: xPlexToken, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := url.JoinPath(baseURL, "/media/providers") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GetMediaProvidersResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetMediaProvidersResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Object = &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetMediaProvidersResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetMediaProvidersServerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -784,7 +1929,7 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi // GetServerList - Get Server List // Get Server List -func (s *Server) GetServerList(ctx context.Context) (*operations.GetServerListResponse, error) { +func (s *Server) GetServerList(ctx context.Context, opts ...operations.Option) (*operations.GetServerListResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getServerList", @@ -792,12 +1937,35 @@ func (s *Server) GetServerList(ctx context.Context) (*operations.GetServerListRe SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/servers") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -809,33 +1977,89 @@ func (s *Server) GetServerList(ctx context.Context) (*operations.GetServerListRe return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetServerListResponse{ @@ -844,17 +2068,25 @@ func (s *Server) GetServerList(ctx context.Context) (*operations.GetServerListRe RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetServerListResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -862,17 +2094,21 @@ func (s *Server) GetServerList(ctx context.Context) (*operations.GetServerListRe res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetServerListResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -881,9 +2117,51 @@ func (s *Server) GetServerList(ctx context.Context) (*operations.GetServerListRe out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetServerListServerResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/sessions.go b/sessions.go index dabf1c1..7319f70 100644 --- a/sessions.go +++ b/sessions.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -28,7 +29,7 @@ func newSessions(sdkConfig sdkConfiguration) *Sessions { // GetSessions - Get Active Sessions // This will retrieve the "Now Playing" Information of the PMS. -func (s *Sessions) GetSessions(ctx context.Context) (*operations.GetSessionsResponse, error) { +func (s *Sessions) GetSessions(ctx context.Context, opts ...operations.Option) (*operations.GetSessionsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getSessions", @@ -36,12 +37,35 @@ func (s *Sessions) GetSessions(ctx context.Context) (*operations.GetSessionsResp SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/status/sessions") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -53,33 +77,89 @@ func (s *Sessions) GetSessions(ctx context.Context) (*operations.GetSessionsResp return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetSessionsResponse{ @@ -88,17 +168,25 @@ func (s *Sessions) GetSessions(ctx context.Context) (*operations.GetSessionsResp RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetSessionsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -106,17 +194,21 @@ func (s *Sessions) GetSessions(ctx context.Context) (*operations.GetSessionsResp res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetSessionsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -125,9 +217,51 @@ func (s *Sessions) GetSessions(ctx context.Context) (*operations.GetSessionsResp out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetSessionsSessionsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -137,7 +271,7 @@ func (s *Sessions) GetSessions(ctx context.Context) (*operations.GetSessionsResp // GetSessionHistory - Get Session History // This will Retrieve a listing of all history views. -func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountID *int64, filter *operations.Filter, librarySectionID *int64) (*operations.GetSessionHistoryResponse, error) { +func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountID *int64, filter *operations.QueryParamFilter, librarySectionID *int64, opts ...operations.Option) (*operations.GetSessionHistoryResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getSessionHistory", @@ -152,12 +286,35 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI LibrarySectionID: librarySectionID, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/status/sessions/history/all") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -173,33 +330,89 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetSessionHistoryResponse{ @@ -208,17 +421,25 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetSessionHistoryResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -226,17 +447,21 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetSessionHistoryResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -245,9 +470,51 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetSessionHistorySessionsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -257,7 +524,7 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI // GetTranscodeSessions - Get Transcode Sessions // Get Transcode Sessions -func (s *Sessions) GetTranscodeSessions(ctx context.Context) (*operations.GetTranscodeSessionsResponse, error) { +func (s *Sessions) GetTranscodeSessions(ctx context.Context, opts ...operations.Option) (*operations.GetTranscodeSessionsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getTranscodeSessions", @@ -265,12 +532,35 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context) (*operations.GetTra SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/transcode/sessions") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -282,33 +572,89 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context) (*operations.GetTra return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetTranscodeSessionsResponse{ @@ -317,17 +663,25 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context) (*operations.GetTra RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetTranscodeSessionsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -335,17 +689,21 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context) (*operations.GetTra res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetTranscodeSessionsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -354,9 +712,51 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context) (*operations.GetTra out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetTranscodeSessionsSessionsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -366,7 +766,7 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context) (*operations.GetTra // StopTranscodeSession - Stop a Transcode Session // Stop a Transcode Session -func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string) (*operations.StopTranscodeSessionResponse, error) { +func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string, opts ...operations.Option) (*operations.StopTranscodeSessionResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "stopTranscodeSession", @@ -378,12 +778,35 @@ func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string) SessionKey: sessionKey, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := utils.GenerateURL(ctx, baseURL, "/transcode/sessions/{sessionKey}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "DELETE", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -395,33 +818,89 @@ func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string) return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.StopTranscodeSessionResponse{ @@ -430,24 +909,26 @@ func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string) RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 204: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.StopTranscodeSessionResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -456,9 +937,51 @@ func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string) out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.StopTranscodeSessionSessionsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/statistics.go b/statistics.go index e430c8e..7190299 100644 --- a/statistics.go +++ b/statistics.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -28,7 +29,7 @@ func newStatistics(sdkConfig sdkConfiguration) *Statistics { // GetStatistics - Get Media Statistics // This will return the media statistics for the server -func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64) (*operations.GetStatisticsResponse, error) { +func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64, opts ...operations.Option) (*operations.GetStatisticsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getStatistics", @@ -40,12 +41,35 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64) (*opera Timespan: timespan, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/statistics/media") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -61,33 +85,89 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64) (*opera return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetStatisticsResponse{ @@ -96,17 +176,25 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64) (*opera RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetStatisticsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -114,17 +202,21 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64) (*opera res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetStatisticsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -133,9 +225,51 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64) (*opera out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetStatisticsStatisticsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -145,7 +279,7 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64) (*opera // GetResourcesStatistics - Get Resources Statistics // This will return the resources for the server -func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64) (*operations.GetResourcesStatisticsResponse, error) { +func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64, opts ...operations.Option) (*operations.GetResourcesStatisticsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getResourcesStatistics", @@ -157,12 +291,35 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 Timespan: timespan, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/statistics/resources") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -178,33 +335,89 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetResourcesStatisticsResponse{ @@ -213,17 +426,25 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetResourcesStatisticsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -231,17 +452,21 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetResourcesStatisticsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -250,9 +475,51 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetResourcesStatisticsStatisticsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -262,7 +529,7 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 // GetBandwidthStatistics - Get Bandwidth Statistics // This will return the bandwidth statistics for the server -func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64) (*operations.GetBandwidthStatisticsResponse, error) { +func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64, opts ...operations.Option) (*operations.GetBandwidthStatisticsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getBandwidthStatistics", @@ -274,12 +541,35 @@ func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64 Timespan: timespan, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/statistics/bandwidth") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -295,33 +585,89 @@ func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64 return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetBandwidthStatisticsResponse{ @@ -330,17 +676,25 @@ func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64 RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetBandwidthStatisticsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -348,17 +702,21 @@ func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64 res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetBandwidthStatisticsResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -367,9 +725,51 @@ func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64 out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetBandwidthStatisticsStatisticsResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/types/bigint.go b/types/bigint.go index afd0cd2..9c6a086 100644 --- a/types/bigint.go +++ b/types/bigint.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/types/date.go b/types/date.go index c4648fa..5b2782f 100644 --- a/types/date.go +++ b/types/date.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/types/datetime.go b/types/datetime.go index 0529b25..3eff332 100644 --- a/types/datetime.go +++ b/types/datetime.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/types/decimal.go b/types/decimal.go index a42284b..d8429bc 100644 --- a/types/decimal.go +++ b/types/decimal.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/types/pointers.go b/types/pointers.go index 4f15e99..950d6a3 100644 --- a/types/pointers.go +++ b/types/pointers.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package types diff --git a/updater.go b/updater.go index 2632f05..82ded76 100644 --- a/updater.go +++ b/updater.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -29,7 +30,7 @@ func newUpdater(sdkConfig sdkConfiguration) *Updater { // GetUpdateStatus - Querying status of updates // Querying status of updates -func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateStatusResponse, error) { +func (s *Updater) GetUpdateStatus(ctx context.Context, opts ...operations.Option) (*operations.GetUpdateStatusResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getUpdateStatus", @@ -37,12 +38,35 @@ func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateSta SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/updater/status") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -54,33 +78,89 @@ func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateSta return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetUpdateStatusResponse{ @@ -89,17 +169,25 @@ func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateSta RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out operations.GetUpdateStatusResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -107,17 +195,21 @@ func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateSta res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetUpdateStatusResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -126,9 +218,51 @@ func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateSta out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetUpdateStatusUpdaterResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -138,7 +272,7 @@ func (s *Updater) GetUpdateStatus(ctx context.Context) (*operations.GetUpdateSta // CheckForUpdates - Checking for updates // Checking for updates -func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Download) (*operations.CheckForUpdatesResponse, error) { +func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Download, opts ...operations.Option) (*operations.CheckForUpdatesResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "checkForUpdates", @@ -150,12 +284,35 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down Download: download, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/updater/check") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -171,33 +328,89 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.CheckForUpdatesResponse{ @@ -206,24 +419,26 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.CheckForUpdatesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -232,9 +447,51 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.CheckForUpdatesUpdaterResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -244,7 +501,7 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down // ApplyUpdates - Apply Updates // Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed -func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, skip *operations.Skip) (*operations.ApplyUpdatesResponse, error) { +func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, skip *operations.Skip, opts ...operations.Option) (*operations.ApplyUpdatesResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "applyUpdates", @@ -257,12 +514,35 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, Skip: skip, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/updater/apply") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "PUT", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -278,33 +558,89 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "500", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.ApplyUpdatesResponse{ @@ -313,26 +649,26 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode == 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.ApplyUpdatesResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -341,9 +677,53 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.ApplyUpdatesUpdaterResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode == 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/video.go b/video.go index 16a4e9e..966ca96 100644 --- a/video.go +++ b/video.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" "net/url" @@ -28,7 +29,7 @@ func newVideo(sdkConfig sdkConfiguration) *Video { // GetTimeline - Get the timeline for a media item // Get the timeline for a media item -func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineRequest) (*operations.GetTimelineResponse, error) { +func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineRequest, opts ...operations.Option) (*operations.GetTimelineResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getTimeline", @@ -36,12 +37,35 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/:/timeline") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -57,33 +81,89 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.GetTimelineResponse{ @@ -92,24 +172,26 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.GetTimelineResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -118,9 +200,51 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetTimelineVideoResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } @@ -130,7 +254,7 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR // StartUniversalTranscode - Start Universal Transcode // Begin a Universal Transcode Session -func (s *Video) StartUniversalTranscode(ctx context.Context, request operations.StartUniversalTranscodeRequest) (*operations.StartUniversalTranscodeResponse, error) { +func (s *Video) StartUniversalTranscode(ctx context.Context, request operations.StartUniversalTranscodeRequest, opts ...operations.Option) (*operations.StartUniversalTranscodeResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "startUniversalTranscode", @@ -138,12 +262,35 @@ func (s *Video) StartUniversalTranscode(ctx context.Context, request operations. SecuritySource: s.sdkConfiguration.Security, } + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/video/:/transcode/universal/start.mpd") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -159,33 +306,89 @@ func (s *Video) StartUniversalTranscode(ctx context.Context, request operations. return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } res := &operations.StartUniversalTranscodeResponse{ @@ -194,24 +397,26 @@ func (s *Video) StartUniversalTranscode(ctx context.Context, request operations. RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + var out sdkerrors.StartUniversalTranscodeResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err @@ -220,9 +425,51 @@ func (s *Video) StartUniversalTranscode(ctx context.Context, request operations. out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.StartUniversalTranscodeVideoResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) } diff --git a/watchlist.go b/watchlist.go index 21d9a20..15997f6 100644 --- a/watchlist.go +++ b/watchlist.go @@ -1,4 +1,4 @@ -// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. package plexgo @@ -10,6 +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" "io" "net/http" ) @@ -25,12 +26,12 @@ func newWatchlist(sdkConfig sdkConfiguration) *Watchlist { } } -// GetWatchlist - Get User Watchlist +// GetWatchList - Get User Watchlist // Get User Watchlist -func (s *Watchlist) GetWatchlist(ctx context.Context, request operations.GetWatchlistRequest, opts ...operations.Option) (*operations.GetWatchlistResponse, error) { +func (s *Watchlist) GetWatchList(ctx context.Context, request operations.GetWatchListRequest, opts ...operations.Option) (*operations.GetWatchListResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, - OperationID: "getWatchlist", + OperationID: "get-watch-list", OAuth2Scopes: []string{}, SecuritySource: s.sdkConfiguration.Security, } @@ -38,6 +39,8 @@ func (s *Watchlist) GetWatchlist(ctx context.Context, request operations.GetWatc o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionServerURL, + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, } for _, opt := range opts { @@ -45,7 +48,8 @@ func (s *Watchlist) GetWatchlist(ctx context.Context, request operations.GetWatc return nil, fmt.Errorf("error applying option: %w", err) } } - baseURL := utils.ReplaceParameters(operations.GetWatchlistServerList[0], map[string]string{}) + + baseURL := utils.ReplaceParameters(operations.GetWatchListServerList[0], map[string]string{}) if o.ServerURL != nil { baseURL = *o.ServerURL } @@ -55,6 +59,17 @@ func (s *Watchlist) GetWatchlist(ctx context.Context, request operations.GetWatc return nil, fmt.Errorf("error generating URL: %w", err) } + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) @@ -70,71 +85,139 @@ func (s *Watchlist) GetWatchlist(ctx context.Context, request operations.GetWatc return nil, err } - req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) - if err != nil { - return nil, err + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } } - httpRes, err := s.sdkConfiguration.Client.Do(req) - if err != nil || httpRes == nil { - if err != nil { - err = fmt.Errorf("error sending request: %w", err) - } else { - err = fmt.Errorf("error sending request: no response") - } + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) - _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) - return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { - _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err - } else if _httpRes != nil { - httpRes = _httpRes + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } } } else { - httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) if err != nil { return nil, err } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } } - res := &operations.GetWatchlistResponse{ + res := &operations.GetWatchListResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) + getRawBody := func() ([]byte, error) { + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + return rawBody, nil } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out operations.GetWatchlistResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out operations.GetWatchListResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Object = &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: - fallthrough - case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: - fallthrough - case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) - case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - var out sdkerrors.GetWatchlistResponseBody + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetWatchListResponseBody if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } @@ -142,9 +225,51 @@ func (s *Watchlist) GetWatchlist(ctx context.Context, request operations.GetWatc out.RawResponse = httpRes return nil, &out default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + var out sdkerrors.GetWatchListWatchlistResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + out.RawResponse = httpRes + return nil, &out + default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: + rawBody, err := getRawBody() + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes) }