ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.308.1

This commit is contained in:
speakeasybot
2024-06-15 00:19:59 +00:00
parent edf95196c3
commit acc9cf3c62
17 changed files with 1448 additions and 111 deletions

View File

@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: e742591b-391d-4f4e-8484-d01a093b32ec
management:
docChecksum: 911d74baa0d06121d2ce2c71d94e977a
docChecksum: 37654ea0982ab5e87a9a9576014c9d19
docVersion: 0.0.3
speakeasyVersion: 1.305.0
generationVersion: 2.340.3
releaseVersion: 0.15.3
configChecksum: c43fc80dfc97b40883b9ebb3195c01cf
speakeasyVersion: 1.308.1
generationVersion: 2.342.6
releaseVersion: 0.16.0
configChecksum: 164b8ea4eba6b7cd1405bc6fda363cba
repoURL: https://github.com/LukeHagar/plexterraform.git
repoSubDirectory: .
published: true
@@ -20,22 +20,24 @@ features:
globals: 2.82.1
methodServerURLs: 2.82.1
nameOverrides: 2.81.2
typeOverrides: 2.81.1
generatedFiles:
- internal/sdk/server.go
- internal/sdk/media.go
- internal/sdk/video.go
- internal/sdk/activities.go
- internal/sdk/butler.go
- internal/sdk/plex.go
- internal/sdk/hubs.go
- internal/sdk/search.go
- internal/sdk/library.go
- internal/sdk/log.go
- internal/sdk/plex.go
- internal/sdk/playlists.go
- internal/sdk/authentication.go
- internal/sdk/statistics.go
- internal/sdk/sessions.go
- internal/sdk/updater.go
- internal/sdk/watchlist.go
- internal/sdk/plexapi.go
- internal/sdk/models/errors/sdkerror.go
- internal/sdk/types/bigint.go
@@ -74,6 +76,9 @@ generatedFiles:
- internal/sdk/models/operations/stopalltasks.go
- internal/sdk/models/operations/starttask.go
- internal/sdk/models/operations/stoptask.go
- internal/sdk/models/operations/gethomedata.go
- internal/sdk/models/operations/getpin.go
- internal/sdk/models/operations/gettoken.go
- internal/sdk/models/operations/getglobalhubs.go
- internal/sdk/models/operations/getlibraryhubs.go
- internal/sdk/models/operations/performsearch.go
@@ -93,8 +98,6 @@ generatedFiles:
- internal/sdk/models/operations/logline.go
- internal/sdk/models/operations/logmultiline.go
- internal/sdk/models/operations/enablepapertrail.go
- internal/sdk/models/operations/getpin.go
- internal/sdk/models/operations/gettoken.go
- internal/sdk/models/operations/createplaylist.go
- internal/sdk/models/operations/getplaylists.go
- internal/sdk/models/operations/getplaylist.go
@@ -114,6 +117,7 @@ generatedFiles:
- internal/sdk/models/operations/getupdatestatus.go
- internal/sdk/models/operations/checkforupdates.go
- internal/sdk/models/operations/applyupdates.go
- internal/sdk/models/operations/getwatchlist.go
- internal/sdk/models/shared/security.go
- internal/sdk/.gitignore
- internal/sdk/models/operations/options.go

View File

@@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
terraform:
version: 0.15.3
version: 0.16.0
additionalDataSources: []
additionalDependencies: {}
additionalResources: []

View File

@@ -1,9 +1,9 @@
speakeasyVersion: 1.305.0
speakeasyVersion: 1.308.1
sources:
my-source:
sourceNamespace: my-source
sourceRevisionDigest: sha256:6b497881c932b4cd0423bf317c54daf4857633509c71c7ff11aecb8c3f8406cb
sourceBlobDigest: sha256:7f5c9cd0e101d066fcef7ffcd0cf5b8fb468feba8fb0d8d495796caa8ed7dba1
sourceRevisionDigest: sha256:632b003c96a45adc5055cf572c4f68c55bc30ef2c1e78f117c8252a940fe2aac
sourceBlobDigest: sha256:73da4378fd215db15f6cbb427c72561917d73a0b910691e12f857e24ac391182
tags:
- latest
- main
@@ -11,8 +11,8 @@ targets:
plexterraform:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:6b497881c932b4cd0423bf317c54daf4857633509c71c7ff11aecb8c3f8406cb
sourceBlobDigest: sha256:7f5c9cd0e101d066fcef7ffcd0cf5b8fb468feba8fb0d8d495796caa8ed7dba1
sourceRevisionDigest: sha256:632b003c96a45adc5055cf572c4f68c55bc30ef2c1e78f117c8252a940fe2aac
sourceBlobDigest: sha256:73da4378fd215db15f6cbb427c72561917d73a0b910691e12f857e24ac391182
outLocation: /github/workspace/repo
workflow:
workflowVersion: 1.0.0

View File

@@ -61,7 +61,7 @@ terraform {
required_providers {
PlexAPI = {
source = "LukeHagar/PlexAPI"
version = "0.15.3"
version = "0.16.0"
}
}
}

View File

@@ -303,3 +303,13 @@ Based on:
- [terraform v0.15.3] .
### Releases
- [Terraform v0.15.3] https://registry.terraform.io/providers/LukeHagar/PlexAPI/0.15.3 - .
## 2024-06-15 00:18:50
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.308.1 (2.342.6) https://github.com/speakeasy-api/speakeasy
### Generated
- [terraform v0.16.0] .
### Releases
- [Terraform v0.16.0] https://registry.terraform.io/providers/LukeHagar/PlexAPI/0.16.0 - .

View File

@@ -17,7 +17,7 @@ terraform {
required_providers {
PlexAPI = {
source = "LukeHagar/PlexAPI"
version = "0.15.3"
version = "0.16.0"
}
}
}

View File

@@ -2,7 +2,7 @@ terraform {
required_providers {
PlexAPI = {
source = "LukeHagar/PlexAPI"
version = "0.15.3"
version = "0.16.0"
}
}
}

View File

@@ -0,0 +1,146 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package operations
import (
"net/http"
)
type GetHomeDataErrors struct {
Code *float64 `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Status *float64 `json:"status,omitempty"`
}
func (o *GetHomeDataErrors) GetCode() *float64 {
if o == nil {
return nil
}
return o.Code
}
func (o *GetHomeDataErrors) GetMessage() *string {
if o == nil {
return nil
}
return o.Message
}
func (o *GetHomeDataErrors) GetStatus() *float64 {
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 []GetHomeDataErrors `json:"errors,omitempty"`
}
func (o *GetHomeDataPlexResponseBody) GetErrors() []GetHomeDataErrors {
if o == nil {
return nil
}
return o.Errors
}
// GetHomeDataResponseBody - Home Data
type GetHomeDataResponseBody struct {
ID *float64 `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
GuestUserID *float64 `json:"guestUserID,omitempty"`
GuestUserUUID *string `json:"guestUserUUID,omitempty"`
GuestEnabled *bool `json:"guestEnabled,omitempty"`
Subscription *bool `json:"subscription,omitempty"`
}
func (o *GetHomeDataResponseBody) GetID() *float64 {
if o == nil {
return nil
}
return o.ID
}
func (o *GetHomeDataResponseBody) GetName() *string {
if o == nil {
return nil
}
return o.Name
}
func (o *GetHomeDataResponseBody) GetGuestUserID() *float64 {
if o == nil {
return nil
}
return o.GuestUserID
}
func (o *GetHomeDataResponseBody) GetGuestUserUUID() *string {
if o == nil {
return nil
}
return o.GuestUserUUID
}
func (o *GetHomeDataResponseBody) GetGuestEnabled() *bool {
if o == nil {
return nil
}
return o.GuestEnabled
}
func (o *GetHomeDataResponseBody) GetSubscription() *bool {
if o == nil {
return nil
}
return o.Subscription
}
type GetHomeDataResponse 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
// Home Data
TwoHundredApplicationJSONObject *GetHomeDataResponseBody
// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
FourHundredAndOneApplicationJSONObject *GetHomeDataPlexResponseBody
}
func (o *GetHomeDataResponse) GetContentType() string {
if o == nil {
return ""
}
return o.ContentType
}
func (o *GetHomeDataResponse) GetStatusCode() int {
if o == nil {
return 0
}
return o.StatusCode
}
func (o *GetHomeDataResponse) GetRawResponse() *http.Response {
if o == nil {
return nil
}
return o.RawResponse
}
func (o *GetHomeDataResponse) GetTwoHundredApplicationJSONObject() *GetHomeDataResponseBody {
if o == nil {
return nil
}
return o.TwoHundredApplicationJSONObject
}
func (o *GetHomeDataResponse) GetFourHundredAndOneApplicationJSONObject() *GetHomeDataPlexResponseBody {
if o == nil {
return nil
}
return o.FourHundredAndOneApplicationJSONObject
}

View File

@@ -153,7 +153,7 @@ func (o *GetLibraryDirectory) GetSearch() *bool {
return o.Search
}
type Filter struct {
type GetLibraryFilter struct {
Filter *string `json:"filter,omitempty"`
FilterType *string `json:"filterType,omitempty"`
Key *string `json:"key,omitempty"`
@@ -161,35 +161,35 @@ type Filter struct {
Type *string `json:"type,omitempty"`
}
func (o *Filter) GetFilter() *string {
func (o *GetLibraryFilter) GetFilter() *string {
if o == nil {
return nil
}
return o.Filter
}
func (o *Filter) GetFilterType() *string {
func (o *GetLibraryFilter) GetFilterType() *string {
if o == nil {
return nil
}
return o.FilterType
}
func (o *Filter) GetKey() *string {
func (o *GetLibraryFilter) GetKey() *string {
if o == nil {
return nil
}
return o.Key
}
func (o *Filter) GetTitle() *string {
func (o *GetLibraryFilter) GetTitle() *string {
if o == nil {
return nil
}
return o.Title
}
func (o *Filter) GetType() *string {
func (o *GetLibraryFilter) GetType() *string {
if o == nil {
return nil
}
@@ -287,7 +287,7 @@ type GetLibraryType struct {
Type *string `json:"type,omitempty"`
Title *string `json:"title,omitempty"`
Active *bool `json:"active,omitempty"`
Filter []Filter `json:"Filter,omitempty"`
Filter []GetLibraryFilter `json:"Filter,omitempty"`
Sort []Sort `json:"Sort,omitempty"`
Field []Field `json:"Field,omitempty"`
}
@@ -320,7 +320,7 @@ func (o *GetLibraryType) GetActive() *bool {
return o.Active
}
func (o *GetLibraryType) GetFilter() []Filter {
func (o *GetLibraryType) GetFilter() []GetLibraryFilter {
if o == nil {
return nil
}

View File

@@ -90,14 +90,14 @@ func (e *Tag) UnmarshalJSON(data []byte) error {
type GetLibraryItemsRequest struct {
// the Id of the library to query
SectionID int64 `pathParam:"style=simple,explode=false,name=sectionId"`
SectionID any `pathParam:"style=simple,explode=false,name=sectionId"`
// A key representing a specific tag within the section.
Tag Tag `pathParam:"style=simple,explode=false,name=tag"`
}
func (o *GetLibraryItemsRequest) GetSectionID() int64 {
func (o *GetLibraryItemsRequest) GetSectionID() any {
if o == nil {
return 0
return nil
}
return o.SectionID
}

View File

@@ -38,6 +38,9 @@ type GetPinRequest struct {
// (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"`
}
func (g GetPinRequest) MarshalJSON() ([]byte, error) {
@@ -65,6 +68,13 @@ func (o *GetPinRequest) GetXPlexClientIdentifier() *string {
return o.XPlexClientIdentifier
}
func (o *GetPinRequest) GetXPlexProduct() string {
if o == nil {
return ""
}
return o.XPlexProduct
}
type GetPinErrors struct {
Code *float64 `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
@@ -111,7 +121,7 @@ type Location struct {
Country *string `json:"country,omitempty"`
City *string `json:"city,omitempty"`
TimeZone *string `json:"time_zone,omitempty"`
PostalCode *float64 `json:"postal_code,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"`
@@ -159,7 +169,7 @@ func (o *Location) GetTimeZone() *string {
return o.TimeZone
}
func (o *Location) GetPostalCode() *float64 {
func (o *Location) GetPostalCode() *string {
if o == nil {
return nil
}
@@ -311,7 +321,7 @@ type GetPinResponse struct {
// Raw HTTP response; suitable for custom response parsing
RawResponse *http.Response
// The Pin
TwoHundredApplicationJSONObject *GetPinResponseBody
TwoHundredAndOneApplicationJSONObject *GetPinResponseBody
// X-Plex-Client-Identifier is missing
FourHundredApplicationJSONObject *GetPinPlexResponseBody
}
@@ -337,11 +347,11 @@ func (o *GetPinResponse) GetRawResponse() *http.Response {
return o.RawResponse
}
func (o *GetPinResponse) GetTwoHundredApplicationJSONObject() *GetPinResponseBody {
func (o *GetPinResponse) GetTwoHundredAndOneApplicationJSONObject() *GetPinResponseBody {
if o == nil {
return nil
}
return o.TwoHundredApplicationJSONObject
return o.TwoHundredAndOneApplicationJSONObject
}
func (o *GetPinResponse) GetFourHundredApplicationJSONObject() *GetPinPlexResponseBody {

View File

@@ -316,7 +316,7 @@ func (o *Role) GetTag() *string {
return o.Tag
}
type Metadata struct {
type GetRecentlyAddedMetadata struct {
AllowSync *bool `json:"allowSync,omitempty"`
LibrarySectionID *float64 `json:"librarySectionID,omitempty"`
LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"`
@@ -351,235 +351,235 @@ type Metadata struct {
Role []Role `json:"Role,omitempty"`
}
func (m Metadata) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(m, "", false)
func (g GetRecentlyAddedMetadata) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(g, "", false)
}
func (m *Metadata) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &m, "", false, false); err != nil {
func (g *GetRecentlyAddedMetadata) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil {
return err
}
return nil
}
func (o *Metadata) GetAllowSync() *bool {
func (o *GetRecentlyAddedMetadata) GetAllowSync() *bool {
if o == nil {
return nil
}
return o.AllowSync
}
func (o *Metadata) GetLibrarySectionID() *float64 {
func (o *GetRecentlyAddedMetadata) GetLibrarySectionID() *float64 {
if o == nil {
return nil
}
return o.LibrarySectionID
}
func (o *Metadata) GetLibrarySectionTitle() *string {
func (o *GetRecentlyAddedMetadata) GetLibrarySectionTitle() *string {
if o == nil {
return nil
}
return o.LibrarySectionTitle
}
func (o *Metadata) GetLibrarySectionUUID() *string {
func (o *GetRecentlyAddedMetadata) GetLibrarySectionUUID() *string {
if o == nil {
return nil
}
return o.LibrarySectionUUID
}
func (o *Metadata) GetRatingKey() *float64 {
func (o *GetRecentlyAddedMetadata) GetRatingKey() *float64 {
if o == nil {
return nil
}
return o.RatingKey
}
func (o *Metadata) GetKey() *string {
func (o *GetRecentlyAddedMetadata) GetKey() *string {
if o == nil {
return nil
}
return o.Key
}
func (o *Metadata) GetGUID() *string {
func (o *GetRecentlyAddedMetadata) GetGUID() *string {
if o == nil {
return nil
}
return o.GUID
}
func (o *Metadata) GetStudio() *string {
func (o *GetRecentlyAddedMetadata) GetStudio() *string {
if o == nil {
return nil
}
return o.Studio
}
func (o *Metadata) GetType() *string {
func (o *GetRecentlyAddedMetadata) GetType() *string {
if o == nil {
return nil
}
return o.Type
}
func (o *Metadata) GetTitle() *string {
func (o *GetRecentlyAddedMetadata) GetTitle() *string {
if o == nil {
return nil
}
return o.Title
}
func (o *Metadata) GetContentRating() *string {
func (o *GetRecentlyAddedMetadata) GetContentRating() *string {
if o == nil {
return nil
}
return o.ContentRating
}
func (o *Metadata) GetSummary() *string {
func (o *GetRecentlyAddedMetadata) GetSummary() *string {
if o == nil {
return nil
}
return o.Summary
}
func (o *Metadata) GetRating() *float64 {
func (o *GetRecentlyAddedMetadata) GetRating() *float64 {
if o == nil {
return nil
}
return o.Rating
}
func (o *Metadata) GetAudienceRating() *float64 {
func (o *GetRecentlyAddedMetadata) GetAudienceRating() *float64 {
if o == nil {
return nil
}
return o.AudienceRating
}
func (o *Metadata) GetYear() *float64 {
func (o *GetRecentlyAddedMetadata) GetYear() *float64 {
if o == nil {
return nil
}
return o.Year
}
func (o *Metadata) GetTagline() *string {
func (o *GetRecentlyAddedMetadata) GetTagline() *string {
if o == nil {
return nil
}
return o.Tagline
}
func (o *Metadata) GetThumb() *string {
func (o *GetRecentlyAddedMetadata) GetThumb() *string {
if o == nil {
return nil
}
return o.Thumb
}
func (o *Metadata) GetArt() *string {
func (o *GetRecentlyAddedMetadata) GetArt() *string {
if o == nil {
return nil
}
return o.Art
}
func (o *Metadata) GetDuration() *float64 {
func (o *GetRecentlyAddedMetadata) GetDuration() *float64 {
if o == nil {
return nil
}
return o.Duration
}
func (o *Metadata) GetOriginallyAvailableAt() *time.Time {
func (o *GetRecentlyAddedMetadata) GetOriginallyAvailableAt() *time.Time {
if o == nil {
return nil
}
return o.OriginallyAvailableAt
}
func (o *Metadata) GetAddedAt() *float64 {
func (o *GetRecentlyAddedMetadata) GetAddedAt() *float64 {
if o == nil {
return nil
}
return o.AddedAt
}
func (o *Metadata) GetUpdatedAt() *float64 {
func (o *GetRecentlyAddedMetadata) GetUpdatedAt() *float64 {
if o == nil {
return nil
}
return o.UpdatedAt
}
func (o *Metadata) GetAudienceRatingImage() *string {
func (o *GetRecentlyAddedMetadata) GetAudienceRatingImage() *string {
if o == nil {
return nil
}
return o.AudienceRatingImage
}
func (o *Metadata) GetChapterSource() *string {
func (o *GetRecentlyAddedMetadata) GetChapterSource() *string {
if o == nil {
return nil
}
return o.ChapterSource
}
func (o *Metadata) GetPrimaryExtraKey() *string {
func (o *GetRecentlyAddedMetadata) GetPrimaryExtraKey() *string {
if o == nil {
return nil
}
return o.PrimaryExtraKey
}
func (o *Metadata) GetRatingImage() *string {
func (o *GetRecentlyAddedMetadata) GetRatingImage() *string {
if o == nil {
return nil
}
return o.RatingImage
}
func (o *Metadata) GetMedia() []Media {
func (o *GetRecentlyAddedMetadata) GetMedia() []Media {
if o == nil {
return nil
}
return o.Media
}
func (o *Metadata) GetGenre() []Genre {
func (o *GetRecentlyAddedMetadata) GetGenre() []Genre {
if o == nil {
return nil
}
return o.Genre
}
func (o *Metadata) GetDirector() []Director {
func (o *GetRecentlyAddedMetadata) GetDirector() []Director {
if o == nil {
return nil
}
return o.Director
}
func (o *Metadata) GetWriter() []Writer {
func (o *GetRecentlyAddedMetadata) GetWriter() []Writer {
if o == nil {
return nil
}
return o.Writer
}
func (o *Metadata) GetCountry() []Country {
func (o *GetRecentlyAddedMetadata) GetCountry() []Country {
if o == nil {
return nil
}
return o.Country
}
func (o *Metadata) GetRole() []Role {
func (o *GetRecentlyAddedMetadata) GetRole() []Role {
if o == nil {
return nil
}
@@ -593,7 +593,7 @@ type GetRecentlyAddedMediaContainer struct {
MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"`
MediaTagVersion *float64 `json:"mediaTagVersion,omitempty"`
MixedParents *bool `json:"mixedParents,omitempty"`
Metadata []Metadata `json:"Metadata,omitempty"`
Metadata []GetRecentlyAddedMetadata `json:"Metadata,omitempty"`
}
func (o *GetRecentlyAddedMediaContainer) GetSize() *float64 {
@@ -638,7 +638,7 @@ func (o *GetRecentlyAddedMediaContainer) GetMixedParents() *bool {
return o.MixedParents
}
func (o *GetRecentlyAddedMediaContainer) GetMetadata() []Metadata {
func (o *GetRecentlyAddedMediaContainer) GetMetadata() []GetRecentlyAddedMetadata {
if o == nil {
return nil
}

View File

@@ -3,7 +3,9 @@
package operations
import (
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/internal/utils"
"net/http"
"time"
)
var GetTokenServerList = []string{
@@ -76,18 +78,217 @@ func (o *GetTokenErrors) GetStatus() *float64 {
return o.Status
}
// GetTokenResponseBody - X-Plex-Client-Identifier is missing
type GetTokenResponseBody struct {
// GetTokenPlexResponseBody - X-Plex-Client-Identifier is missing
type GetTokenPlexResponseBody struct {
Errors []GetTokenErrors `json:"errors,omitempty"`
}
func (o *GetTokenResponseBody) GetErrors() []GetTokenErrors {
func (o *GetTokenPlexResponseBody) GetErrors() []GetTokenErrors {
if o == nil {
return nil
}
return o.Errors
}
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
@@ -95,8 +296,10 @@ type GetTokenResponse struct {
StatusCode int
// Raw HTTP response; suitable for custom response parsing
RawResponse *http.Response
// Access Token
TwoHundredApplicationJSONObject *GetTokenResponseBody
// X-Plex-Client-Identifier is missing
Object *GetTokenResponseBody
FourHundredApplicationJSONObject *GetTokenPlexResponseBody
}
func (o *GetTokenResponse) GetContentType() string {
@@ -120,9 +323,16 @@ func (o *GetTokenResponse) GetRawResponse() *http.Response {
return o.RawResponse
}
func (o *GetTokenResponse) GetObject() *GetTokenResponseBody {
func (o *GetTokenResponse) GetTwoHundredApplicationJSONObject() *GetTokenResponseBody {
if o == nil {
return nil
}
return o.Object
return o.TwoHundredApplicationJSONObject
}
func (o *GetTokenResponse) GetFourHundredApplicationJSONObject() *GetTokenPlexResponseBody {
if o == nil {
return nil
}
return o.FourHundredApplicationJSONObject
}

View File

@@ -0,0 +1,690 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package operations
import (
"encoding/json"
"fmt"
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/internal/utils"
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/types"
"net/http"
)
var GetWatchlistServerList = []string{
"https://metadata.provider.plex.tv",
}
// Filter
type Filter string
const (
FilterAll Filter = "all"
FilterAvailable Filter = "available"
FilterReleased Filter = "released"
)
func (e Filter) ToPointer() *Filter {
return &e
}
func (e *Filter) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "all":
fallthrough
case "available":
fallthrough
case "released":
*e = Filter(v)
return nil
default:
return fmt.Errorf("invalid value for Filter: %v", v)
}
}
// Libtype - The type of library to filter. Can be "movie" or "show", or all if not present.
type Libtype string
const (
LibtypeMovie Libtype = "movie"
LibtypeShow Libtype = "show"
)
func (e Libtype) ToPointer() *Libtype {
return &e
}
func (e *Libtype) UnmarshalJSON(data []byte) error {
var v string
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case "movie":
fallthrough
case "show":
*e = Libtype(v)
return nil
default:
return fmt.Errorf("invalid value for Libtype: %v", v)
}
}
// IncludeCollections - include collections in the results
type IncludeCollections int64
const (
IncludeCollectionsOne IncludeCollections = 1
IncludeCollectionsZero IncludeCollections = 0
)
func (e IncludeCollections) ToPointer() *IncludeCollections {
return &e
}
func (e *IncludeCollections) UnmarshalJSON(data []byte) error {
var v int64
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 1:
fallthrough
case 0:
*e = IncludeCollections(v)
return nil
default:
return fmt.Errorf("invalid value for IncludeCollections: %v", v)
}
}
// IncludeExternalMedia - include external media in the results
type IncludeExternalMedia int64
const (
IncludeExternalMediaOne IncludeExternalMedia = 1
IncludeExternalMediaZero IncludeExternalMedia = 0
)
func (e IncludeExternalMedia) ToPointer() *IncludeExternalMedia {
return &e
}
func (e *IncludeExternalMedia) UnmarshalJSON(data []byte) error {
var v int64
if err := json.Unmarshal(data, &v); err != nil {
return err
}
switch v {
case 1:
fallthrough
case 0:
*e = IncludeExternalMedia(v)
return nil
default:
return fmt.Errorf("invalid value for IncludeExternalMedia: %v", v)
}
}
type GetWatchlistRequest struct {
// 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"
//
Sort *string `queryParam:"style=form,explode=true,name=sort"`
// The type of library to filter. Can be "movie" or "show", or all if not present.
//
Libtype *Libtype `queryParam:"style=form,explode=true,name=libtype"`
// 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.
//
Maxresults *int `queryParam:"style=form,explode=true,name=maxresults"`
// include collections in the results
//
IncludeCollections *IncludeCollections `queryParam:"style=form,explode=true,name=includeCollections"`
// 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.
//
XPlexContainerStart *int `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.
//
XPlexContainerSize *int `queryParam:"style=form,explode=true,name=X-Plex-Container-Size"`
}
func (o *GetWatchlistRequest) GetFilter() Filter {
if o == nil {
return Filter("")
}
return o.Filter
}
func (o *GetWatchlistRequest) GetSort() *string {
if o == nil {
return nil
}
return o.Sort
}
func (o *GetWatchlistRequest) GetLibtype() *Libtype {
if o == nil {
return nil
}
return o.Libtype
}
func (o *GetWatchlistRequest) GetMaxresults() *int {
if o == nil {
return nil
}
return o.Maxresults
}
func (o *GetWatchlistRequest) GetIncludeCollections() *IncludeCollections {
if o == nil {
return nil
}
return o.IncludeCollections
}
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 {
if o == nil {
return nil
}
return o.XPlexContainerStart
}
func (o *GetWatchlistRequest) GetXPlexContainerSize() *int {
if o == nil {
return nil
}
return o.XPlexContainerSize
}
type GetWatchlistErrors struct {
Code *float64 `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Status *float64 `json:"status,omitempty"`
}
func (o *GetWatchlistErrors) GetCode() *float64 {
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() *float64 {
if o == nil {
return nil
}
return o.Status
}
// GetWatchlistWatchlistResponseBody - Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
type GetWatchlistWatchlistResponseBody struct {
Errors []GetWatchlistErrors `json:"errors,omitempty"`
}
func (o *GetWatchlistWatchlistResponseBody) GetErrors() []GetWatchlistErrors {
if o == nil {
return nil
}
return o.Errors
}
type Image struct {
Alt *string `json:"alt,omitempty"`
Type *string `json:"type,omitempty"`
URL *string `json:"url,omitempty"`
}
func (o *Image) GetAlt() *string {
if o == nil {
return nil
}
return o.Alt
}
func (o *Image) GetType() *string {
if o == nil {
return nil
}
return o.Type
}
func (o *Image) GetURL() *string {
if o == nil {
return nil
}
return o.URL
}
type Metadata struct {
Art *string `json:"art,omitempty"`
GUID *string `json:"guid,omitempty"`
Key *string `json:"key,omitempty"`
RatingKey *string `json:"ratingKey,omitempty"`
Studio *string `json:"studio,omitempty"`
Tagline *string `json:"tagline,omitempty"`
Type *string `json:"type,omitempty"`
Thumb *string `json:"thumb,omitempty"`
AddedAt *int `json:"addedAt,omitempty"`
Duration *int `json:"duration,omitempty"`
PublicPagesURL *string `json:"publicPagesURL,omitempty"`
Slug *string `json:"slug,omitempty"`
UserState *bool `json:"userState,omitempty"`
Title *string `json:"title,omitempty"`
ContentRating *string `json:"contentRating,omitempty"`
OriginallyAvailableAt *types.Date `json:"originallyAvailableAt,omitempty"`
Year *int `json:"year,omitempty"`
Image []Image `json:"Image,omitempty"`
Banner *string `json:"banner,omitempty"`
Rating *float64 `json:"rating,omitempty"`
ExpiresAt *int `json:"expiresAt,omitempty"`
OriginalTitle *string `json:"originalTitle,omitempty"`
AudienceRating *float64 `json:"audienceRating,omitempty"`
AudienceRatingImage *string `json:"audienceRatingImage,omitempty"`
RatingImage *string `json:"ratingImage,omitempty"`
ImdbRatingCount *int `json:"imdbRatingCount,omitempty"`
Subtype *string `json:"subtype,omitempty"`
Theme *string `json:"theme,omitempty"`
LeafCount *int `json:"leafCount,omitempty"`
ChildCount *int `json:"childCount,omitempty"`
IsContinuingSeries *bool `json:"isContinuingSeries,omitempty"`
SkipChildren *bool `json:"skipChildren,omitempty"`
AvailabilityID *string `json:"availabilityId,omitempty"`
StreamingMediaID *string `json:"streamingMediaId,omitempty"`
PlayableKey *string `json:"playableKey,omitempty"`
}
func (m Metadata) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(m, "", false)
}
func (m *Metadata) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &m, "", false, false); err != nil {
return err
}
return nil
}
func (o *Metadata) GetArt() *string {
if o == nil {
return nil
}
return o.Art
}
func (o *Metadata) GetGUID() *string {
if o == nil {
return nil
}
return o.GUID
}
func (o *Metadata) GetKey() *string {
if o == nil {
return nil
}
return o.Key
}
func (o *Metadata) GetRatingKey() *string {
if o == nil {
return nil
}
return o.RatingKey
}
func (o *Metadata) GetStudio() *string {
if o == nil {
return nil
}
return o.Studio
}
func (o *Metadata) GetTagline() *string {
if o == nil {
return nil
}
return o.Tagline
}
func (o *Metadata) GetType() *string {
if o == nil {
return nil
}
return o.Type
}
func (o *Metadata) GetThumb() *string {
if o == nil {
return nil
}
return o.Thumb
}
func (o *Metadata) GetAddedAt() *int {
if o == nil {
return nil
}
return o.AddedAt
}
func (o *Metadata) GetDuration() *int {
if o == nil {
return nil
}
return o.Duration
}
func (o *Metadata) GetPublicPagesURL() *string {
if o == nil {
return nil
}
return o.PublicPagesURL
}
func (o *Metadata) GetSlug() *string {
if o == nil {
return nil
}
return o.Slug
}
func (o *Metadata) GetUserState() *bool {
if o == nil {
return nil
}
return o.UserState
}
func (o *Metadata) GetTitle() *string {
if o == nil {
return nil
}
return o.Title
}
func (o *Metadata) GetContentRating() *string {
if o == nil {
return nil
}
return o.ContentRating
}
func (o *Metadata) GetOriginallyAvailableAt() *types.Date {
if o == nil {
return nil
}
return o.OriginallyAvailableAt
}
func (o *Metadata) GetYear() *int {
if o == nil {
return nil
}
return o.Year
}
func (o *Metadata) GetImage() []Image {
if o == nil {
return nil
}
return o.Image
}
func (o *Metadata) GetBanner() *string {
if o == nil {
return nil
}
return o.Banner
}
func (o *Metadata) GetRating() *float64 {
if o == nil {
return nil
}
return o.Rating
}
func (o *Metadata) GetExpiresAt() *int {
if o == nil {
return nil
}
return o.ExpiresAt
}
func (o *Metadata) GetOriginalTitle() *string {
if o == nil {
return nil
}
return o.OriginalTitle
}
func (o *Metadata) GetAudienceRating() *float64 {
if o == nil {
return nil
}
return o.AudienceRating
}
func (o *Metadata) GetAudienceRatingImage() *string {
if o == nil {
return nil
}
return o.AudienceRatingImage
}
func (o *Metadata) GetRatingImage() *string {
if o == nil {
return nil
}
return o.RatingImage
}
func (o *Metadata) GetImdbRatingCount() *int {
if o == nil {
return nil
}
return o.ImdbRatingCount
}
func (o *Metadata) GetSubtype() *string {
if o == nil {
return nil
}
return o.Subtype
}
func (o *Metadata) GetTheme() *string {
if o == nil {
return nil
}
return o.Theme
}
func (o *Metadata) GetLeafCount() *int {
if o == nil {
return nil
}
return o.LeafCount
}
func (o *Metadata) GetChildCount() *int {
if o == nil {
return nil
}
return o.ChildCount
}
func (o *Metadata) GetIsContinuingSeries() *bool {
if o == nil {
return nil
}
return o.IsContinuingSeries
}
func (o *Metadata) GetSkipChildren() *bool {
if o == nil {
return nil
}
return o.SkipChildren
}
func (o *Metadata) GetAvailabilityID() *string {
if o == nil {
return nil
}
return o.AvailabilityID
}
func (o *Metadata) GetStreamingMediaID() *string {
if o == nil {
return nil
}
return o.StreamingMediaID
}
func (o *Metadata) GetPlayableKey() *string {
if o == nil {
return nil
}
return o.PlayableKey
}
// GetWatchlistResponseBody - Watchlist Data
type GetWatchlistResponseBody struct {
LibrarySectionID *string `json:"librarySectionID,omitempty"`
LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"`
Offset *int `json:"offset,omitempty"`
TotalSize *int `json:"totalSize,omitempty"`
Identifier *string `json:"identifier,omitempty"`
Size *int `json:"size,omitempty"`
Metadata []Metadata `json:"Metadata,omitempty"`
}
func (o *GetWatchlistResponseBody) GetLibrarySectionID() *string {
if o == nil {
return nil
}
return o.LibrarySectionID
}
func (o *GetWatchlistResponseBody) GetLibrarySectionTitle() *string {
if o == nil {
return nil
}
return o.LibrarySectionTitle
}
func (o *GetWatchlistResponseBody) GetOffset() *int {
if o == nil {
return nil
}
return o.Offset
}
func (o *GetWatchlistResponseBody) GetTotalSize() *int {
if o == nil {
return nil
}
return o.TotalSize
}
func (o *GetWatchlistResponseBody) GetIdentifier() *string {
if o == nil {
return nil
}
return o.Identifier
}
func (o *GetWatchlistResponseBody) GetSize() *int {
if o == nil {
return nil
}
return o.Size
}
func (o *GetWatchlistResponseBody) GetMetadata() []Metadata {
if o == nil {
return nil
}
return o.Metadata
}
type GetWatchlistResponse 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
// Watchlist Data
TwoHundredApplicationJSONObject *GetWatchlistResponseBody
// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
FourHundredAndOneApplicationJSONObject *GetWatchlistWatchlistResponseBody
}
func (o *GetWatchlistResponse) GetContentType() string {
if o == nil {
return ""
}
return o.ContentType
}
func (o *GetWatchlistResponse) GetStatusCode() int {
if o == nil {
return 0
}
return o.StatusCode
}
func (o *GetWatchlistResponse) GetRawResponse() *http.Response {
if o == nil {
return nil
}
return o.RawResponse
}
func (o *GetWatchlistResponse) GetTwoHundredApplicationJSONObject() *GetWatchlistResponseBody {
if o == nil {
return nil
}
return o.TwoHundredApplicationJSONObject
}
func (o *GetWatchlistResponse) GetFourHundredAndOneApplicationJSONObject() *GetWatchlistWatchlistResponseBody {
if o == nil {
return nil
}
return o.FourHundredAndOneApplicationJSONObject
}

View File

@@ -12,6 +12,7 @@ import (
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/models/operations"
"io"
"net/http"
"net/url"
)
// Plex - API Calls that perform operations directly against https://Plex.tv
@@ -25,6 +26,109 @@ 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) {
hookCtx := hooks.HookContext{
Context: ctx,
OperationID: "getHomeData",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}
baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
opURL, err := url.JoinPath(baseURL, "/home")
if err != nil {
return nil, fmt.Errorf("error generating URL: %w", err)
}
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
}
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{}, 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{
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)
}
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.GetHomeDataResponseBody
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
res.TwoHundredApplicationJSONObject = &out
default:
return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode == 400:
case httpRes.StatusCode == 401:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
var out operations.GetHomeDataPlexResponseBody
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
res.FourHundredAndOneApplicationJSONObject = &out
default:
return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
default:
return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
}
return res, nil
}
// GetPin - Get a Pin
// Retrieve a Pin from Plex.tv for authentication flows
func (s *Plex) GetPin(ctx context.Context, request operations.GetPinRequest, opts ...operations.Option) (*operations.GetPinResponse, error) {
@@ -115,7 +219,7 @@ func (s *Plex) GetPin(ctx context.Context, request operations.GetPinRequest, opt
httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
switch {
case httpRes.StatusCode == 200:
case httpRes.StatusCode == 201:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
var out operations.GetPinResponseBody
@@ -123,7 +227,7 @@ func (s *Plex) GetPin(ctx context.Context, request operations.GetPinRequest, opt
return nil, err
}
res.TwoHundredApplicationJSONObject = &out
res.TwoHundredAndOneApplicationJSONObject = &out
default:
return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
@@ -238,7 +342,6 @@ func (s *Plex) GetToken(ctx context.Context, request operations.GetTokenRequest,
switch {
case httpRes.StatusCode == 200:
case httpRes.StatusCode == 400:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
var out operations.GetTokenResponseBody
@@ -246,7 +349,19 @@ func (s *Plex) GetToken(ctx context.Context, request operations.GetTokenRequest,
return nil, err
}
res.Object = &out
res.TwoHundredApplicationJSONObject = &out
default:
return nil, errors.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 operations.GetTokenPlexResponseBody
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
res.FourHundredApplicationJSONObject = &out
default:
return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}

View File

@@ -91,6 +91,9 @@ type PlexAPI struct {
// Butler is the task manager of the Plex Media Server Ecosystem.
//
Butler *Butler
// API Calls that perform operations directly against https://Plex.tv
//
Plex *Plex
// Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
//
Hubs *Hubs
@@ -103,9 +106,6 @@ type PlexAPI struct {
// Submit logs to the Log Handler for Plex Media Server
//
Log *Log
// API Calls that perform operations directly against https://Plex.tv
//
Plex *Plex
// Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as "all albums from 2017").
// They can be organized in (optionally nesting) folders.
// Retrieving a playlist, or its items, will trigger a refresh of its metadata.
@@ -125,6 +125,9 @@ 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
}
@@ -269,8 +272,8 @@ func New(opts ...SDKOption) *PlexAPI {
Language: "go",
OpenAPIDocVersion: "0.0.3",
SDKVersion: "0.0.1",
GenVersion: "2.340.3",
UserAgent: "speakeasy-sdk/go 0.0.1 2.340.3 0.0.3 github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk",
GenVersion: "2.342.6",
UserAgent: "speakeasy-sdk/go 0.0.1 2.342.6 0.0.3 github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk",
Globals: globals.Globals{},
ServerDefaults: []map[string]string{
{
@@ -308,6 +311,8 @@ func New(opts ...SDKOption) *PlexAPI {
sdk.Butler = newButler(sdk.sdkConfiguration)
sdk.Plex = newPlex(sdk.sdkConfiguration)
sdk.Hubs = newHubs(sdk.sdkConfiguration)
sdk.Search = newSearch(sdk.sdkConfiguration)
@@ -316,8 +321,6 @@ func New(opts ...SDKOption) *PlexAPI {
sdk.Log = newLog(sdk.sdkConfiguration)
sdk.Plex = newPlex(sdk.sdkConfiguration)
sdk.Playlists = newPlaylists(sdk.sdkConfiguration)
sdk.Authentication = newAuthentication(sdk.sdkConfiguration)
@@ -328,5 +331,7 @@ func New(opts ...SDKOption) *PlexAPI {
sdk.Updater = newUpdater(sdk.sdkConfiguration)
sdk.Watchlist = newWatchlist(sdk.sdkConfiguration)
return sdk
}

147
internal/sdk/watchlist.go Normal file
View File

@@ -0,0 +1,147 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package sdk
import (
"bytes"
"context"
"fmt"
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/internal/hooks"
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/internal/utils"
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/models/errors"
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/models/operations"
"io"
"net/http"
)
// Watchlist - API Calls that perform operations with Plex Media Server Watchlists
type Watchlist struct {
sdkConfiguration sdkConfiguration
}
func newWatchlist(sdkConfig sdkConfiguration) *Watchlist {
return &Watchlist{
sdkConfiguration: sdkConfig,
}
}
// GetWatchlist - Get User Watchlist
// Get User Watchlist
func (s *Watchlist) GetWatchlist(ctx context.Context, request operations.GetWatchlistRequest, opts ...operations.Option) (*operations.GetWatchlistResponse, error) {
hookCtx := hooks.HookContext{
Context: ctx,
OperationID: "getWatchlist",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}
o := operations.Options{}
supportedOptions := []string{
operations.SupportedOptionServerURL,
}
for _, opt := range opts {
if err := opt(&o, supportedOptions...); err != nil {
return nil, fmt.Errorf("error applying option: %w", err)
}
}
baseURL := utils.ReplaceParameters(operations.GetWatchlistServerList[0], map[string]string{})
if o.ServerURL != nil {
baseURL = *o.ServerURL
}
opURL, err := utils.GenerateURL(ctx, baseURL, "/library/sections/watchlist/{filter}", request, nil)
if err != nil {
return nil, fmt.Errorf("error generating URL: %w", err)
}
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
}
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{}, 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{
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)
}
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
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
res.TwoHundredApplicationJSONObject = &out
default:
return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode == 400:
case httpRes.StatusCode == 401:
switch {
case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`):
var out operations.GetWatchlistWatchlistResponseBody
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
res.FourHundredAndOneApplicationJSONObject = &out
default:
return nil, errors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes)
}
default:
return nil, errors.NewSDKError("unknown status code returned", httpRes.StatusCode, string(rawBody), httpRes)
}
return res, nil
}