ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.314.2

This commit is contained in:
speakeasybot
2024-06-22 00:19:59 +00:00
parent acc9cf3c62
commit e0b73fab9a
25 changed files with 1565 additions and 58 deletions

View File

@@ -1,12 +1,12 @@
lockVersion: 2.0.0 lockVersion: 2.0.0
id: e742591b-391d-4f4e-8484-d01a093b32ec id: e742591b-391d-4f4e-8484-d01a093b32ec
management: management:
docChecksum: 37654ea0982ab5e87a9a9576014c9d19 docChecksum: e73920abd3a55e8d249592f2e3090574
docVersion: 0.0.3 docVersion: 0.0.3
speakeasyVersion: 1.308.1 speakeasyVersion: 1.314.2
generationVersion: 2.342.6 generationVersion: 2.349.6
releaseVersion: 0.16.0 releaseVersion: 0.17.0
configChecksum: 164b8ea4eba6b7cd1405bc6fda363cba configChecksum: 1ad7c7df83d2c81fab1bf53c153bcd1e
repoURL: https://github.com/LukeHagar/plexterraform.git repoURL: https://github.com/LukeHagar/plexterraform.git
repoSubDirectory: . repoSubDirectory: .
published: true published: true
@@ -14,13 +14,15 @@ features:
terraform: terraform:
additionalDependencies: 0.1.0 additionalDependencies: 0.1.0
constsAndDefaults: 0.1.4 constsAndDefaults: 0.1.4
core: 3.21.3 core: 3.21.4
globalSecurity: 2.81.6 globalSecurity: 2.81.6
globalServerURLs: 2.82.1 globalServerURLs: 2.82.1
globals: 2.82.1 globals: 2.82.1
methodServerURLs: 2.82.1 methodServerURLs: 2.82.1
nameOverrides: 2.81.2 nameOverrides: 2.81.2
nullables: 0.0.0
typeOverrides: 2.81.1 typeOverrides: 2.81.1
unions: 2.81.15
generatedFiles: generatedFiles:
- internal/sdk/server.go - internal/sdk/server.go
- internal/sdk/media.go - internal/sdk/media.go
@@ -94,6 +96,7 @@ generatedFiles:
- internal/sdk/models/operations/searchlibrary.go - internal/sdk/models/operations/searchlibrary.go
- internal/sdk/models/operations/getmetadata.go - internal/sdk/models/operations/getmetadata.go
- internal/sdk/models/operations/getmetadatachildren.go - internal/sdk/models/operations/getmetadatachildren.go
- internal/sdk/models/operations/gettopwatchedcontent.go
- internal/sdk/models/operations/getondeck.go - internal/sdk/models/operations/getondeck.go
- internal/sdk/models/operations/logline.go - internal/sdk/models/operations/logline.go
- internal/sdk/models/operations/logmultiline.go - internal/sdk/models/operations/logmultiline.go
@@ -110,6 +113,8 @@ generatedFiles:
- internal/sdk/models/operations/gettransienttoken.go - internal/sdk/models/operations/gettransienttoken.go
- internal/sdk/models/operations/getsourceconnectioninformation.go - internal/sdk/models/operations/getsourceconnectioninformation.go
- internal/sdk/models/operations/getstatistics.go - internal/sdk/models/operations/getstatistics.go
- internal/sdk/models/operations/getresourcesstatistics.go
- internal/sdk/models/operations/getbandwidthstatistics.go
- internal/sdk/models/operations/getsessions.go - internal/sdk/models/operations/getsessions.go
- internal/sdk/models/operations/getsessionhistory.go - internal/sdk/models/operations/getsessionhistory.go
- internal/sdk/models/operations/gettranscodesessions.go - internal/sdk/models/operations/gettranscodesessions.go

View File

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

View File

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

View File

@@ -61,7 +61,7 @@ terraform {
required_providers { required_providers {
PlexAPI = { PlexAPI = {
source = "LukeHagar/PlexAPI" source = "LukeHagar/PlexAPI"
version = "0.16.0" version = "0.17.0"
} }
} }
} }
@@ -102,18 +102,18 @@ TF_REATTACH_PROVIDERS=... terraform apply
<!-- Start Global Parameters [global-parameters] --> <!-- Start Global Parameters [global-parameters] -->
## Global Parameters ## Global Parameters
A parameter is configured globally. This parameter must 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. 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 `"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.
### Available Globals ### Available Globals
The following global parameter is available. The required parameter must be set when you initialize the SDK client. The following global parameter is available.
| Name | Type | Required | Description | | Name | Type | Required | Description |
| ---- | ---- |:--------:| ----------- | | ---- | ---- |:--------:| ----------- |
| XPlexClientIdentifier | string | ✔️ | The unique identifier for the client application | XPlexClientIdentifier | string | | The unique identifier for the client application
This is used to track the client application and its usage This is used to track the client application and its usage
(UUID, serial number, or other number unique per device) (UUID, serial number, or other number unique per device)
| |

View File

@@ -312,4 +312,14 @@ Based on:
### Generated ### Generated
- [terraform v0.16.0] . - [terraform v0.16.0] .
### Releases ### Releases
- [Terraform v0.16.0] https://registry.terraform.io/providers/LukeHagar/PlexAPI/0.16.0 - . - [Terraform v0.16.0] https://registry.terraform.io/providers/LukeHagar/PlexAPI/0.16.0 - .
## 2024-06-22 00:18:49
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.314.2 (2.349.6) https://github.com/speakeasy-api/speakeasy
### Generated
- [terraform v0.17.0] .
### Releases
- [Terraform v0.17.0] https://registry.terraform.io/providers/LukeHagar/PlexAPI/0.17.0 - .

View File

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

View File

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

View File

@@ -7,12 +7,12 @@ type Globals struct {
// This is used to track the client application and its usage // This is used to track the client application and its usage
// (UUID, serial number, or other number unique per device) // (UUID, serial number, or other number unique per device)
// //
XPlexClientIdentifier string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"`
} }
func (o *Globals) GetXPlexClientIdentifier() string { func (o *Globals) GetXPlexClientIdentifier() *string {
if o == nil { if o == nil {
return "" return nil
} }
return o.XPlexClientIdentifier return o.XPlexClientIdentifier
} }

View File

@@ -9,6 +9,10 @@ import (
) )
func MatchContentType(contentType string, pattern string) bool { func MatchContentType(contentType string, pattern string) bool {
if contentType == "" {
contentType = "application/octet-stream"
}
if contentType == pattern || pattern == "*" || pattern == "*/*" { if contentType == pattern || pattern == "*" || pattern == "*/*" {
return true return true
} }

View File

@@ -614,6 +614,10 @@ func (s *Library) GetLibraryItems(ctx context.Context, request operations.GetLib
req.Header.Set("Accept", "application/json") req.Header.Set("Accept", "application/json")
req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) 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 { if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
return nil, err return nil, err
} }
@@ -1037,6 +1041,10 @@ func (s *Library) GetMetadataChildren(ctx context.Context, request operations.Ge
req.Header.Set("Accept", "application/json") req.Header.Set("Accept", "application/json")
req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) 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 { if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
return nil, err return nil, err
} }
@@ -1117,6 +1125,100 @@ func (s *Library) GetMetadataChildren(ctx context.Context, request operations.Ge
} }
// 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, request operations.GetTopWatchedContentRequest) (*operations.GetTopWatchedContentResponse, error) {
hookCtx := hooks.HookContext{
Context: ctx,
OperationID: "getTopWatchedContent",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}
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)
}
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.GetTopWatchedContentResponse{
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.GetTopWatchedContentResponseBody
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
res.Object = &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
}
// GetOnDeck - Get On Deck // GetOnDeck - Get On Deck
// This endpoint will return the on deck content. // 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) (*operations.GetOnDeckResponse, error) {

View File

@@ -0,0 +1,316 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package operations
import (
"net/http"
)
type GetBandwidthStatisticsRequest struct {
// The timespan to retrieve statistics for
// the exact meaning of this parameter is not known
//
Timespan *int64 `queryParam:"style=form,explode=true,name=Timespan"`
}
func (o *GetBandwidthStatisticsRequest) GetTimespan() *int64 {
if o == nil {
return nil
}
return o.Timespan
}
type GetBandwidthStatisticsErrors struct {
Code *float64 `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Status *float64 `json:"status,omitempty"`
}
func (o *GetBandwidthStatisticsErrors) GetCode() *float64 {
if o == nil {
return nil
}
return o.Code
}
func (o *GetBandwidthStatisticsErrors) GetMessage() *string {
if o == nil {
return nil
}
return o.Message
}
func (o *GetBandwidthStatisticsErrors) GetStatus() *float64 {
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 []GetBandwidthStatisticsErrors `json:"errors,omitempty"`
}
func (o *GetBandwidthStatisticsStatisticsResponseBody) GetErrors() []GetBandwidthStatisticsErrors {
if o == nil {
return nil
}
return o.Errors
}
type GetBandwidthStatisticsDevice struct {
ID *int `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Platform *string `json:"platform,omitempty"`
ClientIdentifier *string `json:"clientIdentifier,omitempty"`
CreatedAt *int `json:"createdAt,omitempty"`
}
func (o *GetBandwidthStatisticsDevice) GetID() *int {
if o == nil {
return nil
}
return o.ID
}
func (o *GetBandwidthStatisticsDevice) GetName() *string {
if o == nil {
return nil
}
return o.Name
}
func (o *GetBandwidthStatisticsDevice) GetPlatform() *string {
if o == nil {
return nil
}
return o.Platform
}
func (o *GetBandwidthStatisticsDevice) GetClientIdentifier() *string {
if o == nil {
return nil
}
return o.ClientIdentifier
}
func (o *GetBandwidthStatisticsDevice) GetCreatedAt() *int {
if o == nil {
return nil
}
return o.CreatedAt
}
type GetBandwidthStatisticsAccount struct {
ID *int `json:"id,omitempty"`
Key *string `json:"key,omitempty"`
Name *string `json:"name,omitempty"`
DefaultAudioLanguage *string `json:"defaultAudioLanguage,omitempty"`
AutoSelectAudio *bool `json:"autoSelectAudio,omitempty"`
DefaultSubtitleLanguage *string `json:"defaultSubtitleLanguage,omitempty"`
SubtitleMode *int `json:"subtitleMode,omitempty"`
Thumb *string `json:"thumb,omitempty"`
}
func (o *GetBandwidthStatisticsAccount) GetID() *int {
if o == nil {
return nil
}
return o.ID
}
func (o *GetBandwidthStatisticsAccount) GetKey() *string {
if o == nil {
return nil
}
return o.Key
}
func (o *GetBandwidthStatisticsAccount) GetName() *string {
if o == nil {
return nil
}
return o.Name
}
func (o *GetBandwidthStatisticsAccount) GetDefaultAudioLanguage() *string {
if o == nil {
return nil
}
return o.DefaultAudioLanguage
}
func (o *GetBandwidthStatisticsAccount) GetAutoSelectAudio() *bool {
if o == nil {
return nil
}
return o.AutoSelectAudio
}
func (o *GetBandwidthStatisticsAccount) GetDefaultSubtitleLanguage() *string {
if o == nil {
return nil
}
return o.DefaultSubtitleLanguage
}
func (o *GetBandwidthStatisticsAccount) GetSubtitleMode() *int {
if o == nil {
return nil
}
return o.SubtitleMode
}
func (o *GetBandwidthStatisticsAccount) GetThumb() *string {
if o == nil {
return nil
}
return o.Thumb
}
type StatisticsBandwidth struct {
AccountID *int `json:"accountID,omitempty"`
DeviceID *int `json:"deviceID,omitempty"`
Timespan *int64 `json:"timespan,omitempty"`
At *int `json:"at,omitempty"`
Lan *bool `json:"lan,omitempty"`
Bytes *int64 `json:"bytes,omitempty"`
}
func (o *StatisticsBandwidth) GetAccountID() *int {
if o == nil {
return nil
}
return o.AccountID
}
func (o *StatisticsBandwidth) GetDeviceID() *int {
if o == nil {
return nil
}
return o.DeviceID
}
func (o *StatisticsBandwidth) GetTimespan() *int64 {
if o == nil {
return nil
}
return o.Timespan
}
func (o *StatisticsBandwidth) GetAt() *int {
if o == nil {
return nil
}
return o.At
}
func (o *StatisticsBandwidth) GetLan() *bool {
if o == nil {
return nil
}
return o.Lan
}
func (o *StatisticsBandwidth) GetBytes() *int64 {
if o == nil {
return nil
}
return o.Bytes
}
type GetBandwidthStatisticsMediaContainer struct {
Size *int `json:"size,omitempty"`
Device []GetBandwidthStatisticsDevice `json:"Device,omitempty"`
Account []GetBandwidthStatisticsAccount `json:"Account,omitempty"`
StatisticsBandwidth []StatisticsBandwidth `json:"StatisticsBandwidth,omitempty"`
}
func (o *GetBandwidthStatisticsMediaContainer) GetSize() *int {
if o == nil {
return nil
}
return o.Size
}
func (o *GetBandwidthStatisticsMediaContainer) GetDevice() []GetBandwidthStatisticsDevice {
if o == nil {
return nil
}
return o.Device
}
func (o *GetBandwidthStatisticsMediaContainer) GetAccount() []GetBandwidthStatisticsAccount {
if o == nil {
return nil
}
return o.Account
}
func (o *GetBandwidthStatisticsMediaContainer) GetStatisticsBandwidth() []StatisticsBandwidth {
if o == nil {
return nil
}
return o.StatisticsBandwidth
}
// GetBandwidthStatisticsResponseBody - Bandwidth Statistics
type GetBandwidthStatisticsResponseBody struct {
MediaContainer *GetBandwidthStatisticsMediaContainer `json:"MediaContainer,omitempty"`
}
func (o *GetBandwidthStatisticsResponseBody) GetMediaContainer() *GetBandwidthStatisticsMediaContainer {
if o == nil {
return nil
}
return o.MediaContainer
}
type GetBandwidthStatisticsResponse 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
// Bandwidth Statistics
TwoHundredApplicationJSONObject *GetBandwidthStatisticsResponseBody
// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
FourHundredAndOneApplicationJSONObject *GetBandwidthStatisticsStatisticsResponseBody
}
func (o *GetBandwidthStatisticsResponse) GetContentType() string {
if o == nil {
return ""
}
return o.ContentType
}
func (o *GetBandwidthStatisticsResponse) GetStatusCode() int {
if o == nil {
return 0
}
return o.StatusCode
}
func (o *GetBandwidthStatisticsResponse) GetRawResponse() *http.Response {
if o == nil {
return nil
}
return o.RawResponse
}
func (o *GetBandwidthStatisticsResponse) GetTwoHundredApplicationJSONObject() *GetBandwidthStatisticsResponseBody {
if o == nil {
return nil
}
return o.TwoHundredApplicationJSONObject
}
func (o *GetBandwidthStatisticsResponse) GetFourHundredAndOneApplicationJSONObject() *GetBandwidthStatisticsStatisticsResponseBody {
if o == nil {
return nil
}
return o.FourHundredAndOneApplicationJSONObject
}

View File

@@ -4,6 +4,7 @@ package operations
import ( import (
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/internal/utils" "github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/internal/utils"
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/types" "github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/types"
@@ -93,6 +94,9 @@ type GetLibraryItemsRequest struct {
SectionID any `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. // A key representing a specific tag within the section.
Tag Tag `pathParam:"style=simple,explode=false,name=tag"` 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"`
} }
func (o *GetLibraryItemsRequest) GetSectionID() any { func (o *GetLibraryItemsRequest) GetSectionID() any {
@@ -109,6 +113,13 @@ func (o *GetLibraryItemsRequest) GetTag() Tag {
return o.Tag return o.Tag
} }
func (o *GetLibraryItemsRequest) GetIncludeGuids() *int64 {
if o == nil {
return nil
}
return o.IncludeGuids
}
type GetLibraryItemsErrors struct { type GetLibraryItemsErrors struct {
Code *float64 `json:"code,omitempty"` Code *float64 `json:"code,omitempty"`
Message *string `json:"message,omitempty"` Message *string `json:"message,omitempty"`
@@ -148,6 +159,69 @@ func (o *GetLibraryItemsLibraryResponseBody) GetErrors() []GetLibraryItemsErrors
return o.Errors return o.Errors
} }
type LibrarySectionIDType string
const (
LibrarySectionIDTypeInteger LibrarySectionIDType = "integer"
LibrarySectionIDTypeStr LibrarySectionIDType = "str"
)
type LibrarySectionID struct {
Integer *int64
Str *string
Type LibrarySectionIDType
}
func CreateLibrarySectionIDInteger(integer int64) LibrarySectionID {
typ := LibrarySectionIDTypeInteger
return LibrarySectionID{
Integer: &integer,
Type: typ,
}
}
func CreateLibrarySectionIDStr(str string) LibrarySectionID {
typ := LibrarySectionIDTypeStr
return LibrarySectionID{
Str: &str,
Type: typ,
}
}
func (u *LibrarySectionID) UnmarshalJSON(data []byte) error {
var integer int64 = int64(0)
if err := utils.UnmarshalJSON(data, &integer, "", true, true); err == nil {
u.Integer = &integer
u.Type = LibrarySectionIDTypeInteger
return nil
}
var str string = ""
if err := utils.UnmarshalJSON(data, &str, "", true, true); err == nil {
u.Str = &str
u.Type = LibrarySectionIDTypeStr
return nil
}
return fmt.Errorf("could not unmarshal `%s` into any supported union types for LibrarySectionID", string(data))
}
func (u LibrarySectionID) MarshalJSON() ([]byte, error) {
if u.Integer != nil {
return utils.MarshalJSON(u.Integer, "", true)
}
if u.Str != nil {
return utils.MarshalJSON(u.Str, "", true)
}
return nil, errors.New("could not marshal union type LibrarySectionID: all fields are null")
}
type GetLibraryItemsPart struct { type GetLibraryItemsPart struct {
ID *int `json:"id,omitempty"` ID *int `json:"id,omitempty"`
Key *string `json:"key,omitempty"` Key *string `json:"key,omitempty"`
@@ -852,7 +926,7 @@ type GetLibraryItemsMediaContainer struct {
AllowSync *bool `json:"allowSync,omitempty"` AllowSync *bool `json:"allowSync,omitempty"`
Art *string `json:"art,omitempty"` Art *string `json:"art,omitempty"`
Identifier *string `json:"identifier,omitempty"` Identifier *string `json:"identifier,omitempty"`
LibrarySectionID *int `json:"librarySectionID,omitempty"` LibrarySectionID *LibrarySectionID `json:"librarySectionID,omitempty"`
LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"` LibrarySectionTitle *string `json:"librarySectionTitle,omitempty"`
LibrarySectionUUID *string `json:"librarySectionUUID,omitempty"` LibrarySectionUUID *string `json:"librarySectionUUID,omitempty"`
MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"` MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"`
@@ -894,7 +968,7 @@ func (o *GetLibraryItemsMediaContainer) GetIdentifier() *string {
return o.Identifier return o.Identifier
} }
func (o *GetLibraryItemsMediaContainer) GetLibrarySectionID() *int { func (o *GetLibraryItemsMediaContainer) GetLibrarySectionID() *LibrarySectionID {
if o == nil { if o == nil {
return nil return nil
} }

View File

@@ -9,6 +9,9 @@ import (
type GetMetadataChildrenRequest struct { type GetMetadataChildrenRequest struct {
// the id of the library item to return the children of. // the id of the library item to return the children of.
RatingKey float64 `pathParam:"style=simple,explode=false,name=ratingKey"` RatingKey float64 `pathParam:"style=simple,explode=false,name=ratingKey"`
// Adds additional elements to the response. Supported types are (Stream)
//
IncludeElements *string `queryParam:"style=form,explode=true,name=includeElements"`
} }
func (o *GetMetadataChildrenRequest) GetRatingKey() float64 { func (o *GetMetadataChildrenRequest) GetRatingKey() float64 {
@@ -18,6 +21,13 @@ func (o *GetMetadataChildrenRequest) GetRatingKey() float64 {
return o.RatingKey return o.RatingKey
} }
func (o *GetMetadataChildrenRequest) GetIncludeElements() *string {
if o == nil {
return nil
}
return o.IncludeElements
}
type GetMetadataChildrenErrors struct { type GetMetadataChildrenErrors struct {
Code *float64 `json:"code,omitempty"` Code *float64 `json:"code,omitempty"`
Message *string `json:"message,omitempty"` Message *string `json:"message,omitempty"`

View File

@@ -17,12 +17,12 @@ type GetPinGlobals struct {
// This is used to track the client application and its usage // This is used to track the client application and its usage
// (UUID, serial number, or other number unique per device) // (UUID, serial number, or other number unique per device)
// //
XPlexClientIdentifier string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"`
} }
func (o *GetPinGlobals) GetXPlexClientIdentifier() string { func (o *GetPinGlobals) GetXPlexClientIdentifier() *string {
if o == nil { if o == nil {
return "" return nil
} }
return o.XPlexClientIdentifier return o.XPlexClientIdentifier
} }
@@ -215,7 +215,7 @@ type GetPinResponseBody struct {
CreatedAt *time.Time `json:"createdAt,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty"`
ExpiresAt *time.Time `json:"expiresAt,omitempty"` ExpiresAt *time.Time `json:"expiresAt,omitempty"`
AuthToken *string `json:"authToken,omitempty"` AuthToken *string `json:"authToken,omitempty"`
NewRegistration *string `json:"newRegistration,omitempty"` NewRegistration *bool `json:"newRegistration,omitempty"`
} }
func (g GetPinResponseBody) MarshalJSON() ([]byte, error) { func (g GetPinResponseBody) MarshalJSON() ([]byte, error) {
@@ -306,7 +306,7 @@ func (o *GetPinResponseBody) GetAuthToken() *string {
return o.AuthToken return o.AuthToken
} }
func (o *GetPinResponseBody) GetNewRegistration() *string { func (o *GetPinResponseBody) GetNewRegistration() *bool {
if o == nil { if o == nil {
return nil return nil
} }

View File

@@ -0,0 +1,190 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package operations
import (
"net/http"
)
type GetResourcesStatisticsRequest struct {
// The timespan to retrieve statistics for
// the exact meaning of this parameter is not known
//
Timespan *int64 `queryParam:"style=form,explode=true,name=Timespan"`
}
func (o *GetResourcesStatisticsRequest) GetTimespan() *int64 {
if o == nil {
return nil
}
return o.Timespan
}
type GetResourcesStatisticsErrors struct {
Code *float64 `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Status *float64 `json:"status,omitempty"`
}
func (o *GetResourcesStatisticsErrors) GetCode() *float64 {
if o == nil {
return nil
}
return o.Code
}
func (o *GetResourcesStatisticsErrors) GetMessage() *string {
if o == nil {
return nil
}
return o.Message
}
func (o *GetResourcesStatisticsErrors) GetStatus() *float64 {
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 []GetResourcesStatisticsErrors `json:"errors,omitempty"`
}
func (o *GetResourcesStatisticsStatisticsResponseBody) GetErrors() []GetResourcesStatisticsErrors {
if o == nil {
return nil
}
return o.Errors
}
type StatisticsResources struct {
Timespan *int64 `json:"timespan,omitempty"`
At *int64 `json:"at,omitempty"`
HostCPUUtilization *float32 `json:"hostCpuUtilization,omitempty"`
ProcessCPUUtilization *float32 `json:"processCpuUtilization,omitempty"`
HostMemoryUtilization *float32 `json:"hostMemoryUtilization,omitempty"`
ProcessMemoryUtilization *float32 `json:"processMemoryUtilization,omitempty"`
}
func (o *StatisticsResources) GetTimespan() *int64 {
if o == nil {
return nil
}
return o.Timespan
}
func (o *StatisticsResources) GetAt() *int64 {
if o == nil {
return nil
}
return o.At
}
func (o *StatisticsResources) GetHostCPUUtilization() *float32 {
if o == nil {
return nil
}
return o.HostCPUUtilization
}
func (o *StatisticsResources) GetProcessCPUUtilization() *float32 {
if o == nil {
return nil
}
return o.ProcessCPUUtilization
}
func (o *StatisticsResources) GetHostMemoryUtilization() *float32 {
if o == nil {
return nil
}
return o.HostMemoryUtilization
}
func (o *StatisticsResources) GetProcessMemoryUtilization() *float32 {
if o == nil {
return nil
}
return o.ProcessMemoryUtilization
}
type GetResourcesStatisticsMediaContainer struct {
Size *int `json:"size,omitempty"`
StatisticsResources []StatisticsResources `json:"StatisticsResources,omitempty"`
}
func (o *GetResourcesStatisticsMediaContainer) GetSize() *int {
if o == nil {
return nil
}
return o.Size
}
func (o *GetResourcesStatisticsMediaContainer) GetStatisticsResources() []StatisticsResources {
if o == nil {
return nil
}
return o.StatisticsResources
}
// GetResourcesStatisticsResponseBody - Resource Statistics
type GetResourcesStatisticsResponseBody struct {
MediaContainer *GetResourcesStatisticsMediaContainer `json:"MediaContainer,omitempty"`
}
func (o *GetResourcesStatisticsResponseBody) GetMediaContainer() *GetResourcesStatisticsMediaContainer {
if o == nil {
return nil
}
return o.MediaContainer
}
type GetResourcesStatisticsResponse 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
// Resource Statistics
TwoHundredApplicationJSONObject *GetResourcesStatisticsResponseBody
// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
FourHundredAndOneApplicationJSONObject *GetResourcesStatisticsStatisticsResponseBody
}
func (o *GetResourcesStatisticsResponse) GetContentType() string {
if o == nil {
return ""
}
return o.ContentType
}
func (o *GetResourcesStatisticsResponse) GetStatusCode() int {
if o == nil {
return 0
}
return o.StatusCode
}
func (o *GetResourcesStatisticsResponse) GetRawResponse() *http.Response {
if o == nil {
return nil
}
return o.RawResponse
}
func (o *GetResourcesStatisticsResponse) GetTwoHundredApplicationJSONObject() *GetResourcesStatisticsResponseBody {
if o == nil {
return nil
}
return o.TwoHundredApplicationJSONObject
}
func (o *GetResourcesStatisticsResponse) GetFourHundredAndOneApplicationJSONObject() *GetResourcesStatisticsStatisticsResponseBody {
if o == nil {
return nil
}
return o.FourHundredAndOneApplicationJSONObject
}

View File

@@ -8,6 +8,55 @@ import (
"net/http" "net/http"
) )
// Filter - Filters content by field and direction/equality
// (Unknown if viewedAt is the only supported column)
type Filter struct {
}
type GetSessionHistoryRequest struct {
// Sorts the results by the specified field followed by the direction (asc, desc)
//
Sort *string `queryParam:"style=form,explode=true,name=sort"`
// Filter results by those that are related to a specific users id
//
AccountID *int64 `queryParam:"style=form,explode=true,name=accountId"`
// Filters content by field and direction/equality
// (Unknown if viewedAt is the only supported column)
//
Filter *Filter `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"`
}
func (o *GetSessionHistoryRequest) GetSort() *string {
if o == nil {
return nil
}
return o.Sort
}
func (o *GetSessionHistoryRequest) GetAccountID() *int64 {
if o == nil {
return nil
}
return o.AccountID
}
func (o *GetSessionHistoryRequest) GetFilter() *Filter {
if o == nil {
return nil
}
return o.Filter
}
func (o *GetSessionHistoryRequest) GetLibrarySectionID() *int64 {
if o == nil {
return nil
}
return o.LibrarySectionID
}
type GetSessionHistoryErrors struct { type GetSessionHistoryErrors struct {
Code *float64 `json:"code,omitempty"` Code *float64 `json:"code,omitempty"`
Message *string `json:"message,omitempty"` Message *string `json:"message,omitempty"`

View File

@@ -358,27 +358,27 @@ func (o *GetSessionsMedia) GetPart() []GetSessionsPart {
return o.Part return o.Part
} }
type User struct { type GetSessionsUser struct {
ID *string `json:"id,omitempty"` ID *string `json:"id,omitempty"`
Thumb *string `json:"thumb,omitempty"` Thumb *string `json:"thumb,omitempty"`
Title *string `json:"title,omitempty"` Title *string `json:"title,omitempty"`
} }
func (o *User) GetID() *string { func (o *GetSessionsUser) GetID() *string {
if o == nil { if o == nil {
return nil return nil
} }
return o.ID return o.ID
} }
func (o *User) GetThumb() *string { func (o *GetSessionsUser) GetThumb() *string {
if o == nil { if o == nil {
return nil return nil
} }
return o.Thumb return o.Thumb
} }
func (o *User) GetTitle() *string { func (o *GetSessionsUser) GetTitle() *string {
if o == nil { if o == nil {
return nil return nil
} }
@@ -570,7 +570,7 @@ type GetSessionsMetadata struct {
UpdatedAt *int `json:"updatedAt,omitempty"` UpdatedAt *int `json:"updatedAt,omitempty"`
ViewOffset *int `json:"viewOffset,omitempty"` ViewOffset *int `json:"viewOffset,omitempty"`
Media []GetSessionsMedia `json:"Media,omitempty"` Media []GetSessionsMedia `json:"Media,omitempty"`
User *User `json:"User,omitempty"` User *GetSessionsUser `json:"User,omitempty"`
Player *Player `json:"Player,omitempty"` Player *Player `json:"Player,omitempty"`
Session *Session `json:"Session,omitempty"` Session *Session `json:"Session,omitempty"`
} }
@@ -813,7 +813,7 @@ func (o *GetSessionsMetadata) GetMedia() []GetSessionsMedia {
return o.Media return o.Media
} }
func (o *GetSessionsMetadata) GetUser() *User { func (o *GetSessionsMetadata) GetUser() *GetSessionsUser {
if o == nil { if o == nil {
return nil return nil
} }

View File

@@ -17,12 +17,12 @@ type GetTokenGlobals struct {
// This is used to track the client application and its usage // This is used to track the client application and its usage
// (UUID, serial number, or other number unique per device) // (UUID, serial number, or other number unique per device)
// //
XPlexClientIdentifier string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"` XPlexClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"`
} }
func (o *GetTokenGlobals) GetXPlexClientIdentifier() string { func (o *GetTokenGlobals) GetXPlexClientIdentifier() *string {
if o == nil { if o == nil {
return "" return nil
} }
return o.XPlexClientIdentifier return o.XPlexClientIdentifier
} }

View File

@@ -0,0 +1,530 @@
// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
package operations
import (
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/internal/utils"
"github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk/types"
"net/http"
)
type GetTopWatchedContentRequest struct {
// the library type (1 - movies, 2 - shows, 3 - music)
Type int64 `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 {
if o == nil {
return 0
}
return o.Type
}
func (o *GetTopWatchedContentRequest) GetIncludeGuids() *int64 {
if o == nil {
return nil
}
return o.IncludeGuids
}
type GetTopWatchedContentGenre struct {
ID *int `json:"id,omitempty"`
Filter *string `json:"filter,omitempty"`
Tag *string `json:"tag,omitempty"`
}
func (o *GetTopWatchedContentGenre) GetID() *int {
if o == nil {
return nil
}
return o.ID
}
func (o *GetTopWatchedContentGenre) GetFilter() *string {
if o == nil {
return nil
}
return o.Filter
}
func (o *GetTopWatchedContentGenre) GetTag() *string {
if o == nil {
return nil
}
return o.Tag
}
type GetTopWatchedContentCountry struct {
ID *int `json:"id,omitempty"`
Filter *string `json:"filter,omitempty"`
Tag *string `json:"tag,omitempty"`
}
func (o *GetTopWatchedContentCountry) GetID() *int {
if o == nil {
return nil
}
return o.ID
}
func (o *GetTopWatchedContentCountry) GetFilter() *string {
if o == nil {
return nil
}
return o.Filter
}
func (o *GetTopWatchedContentCountry) GetTag() *string {
if o == nil {
return nil
}
return o.Tag
}
type GetTopWatchedContentGuids struct {
ID *string `json:"id,omitempty"`
}
func (o *GetTopWatchedContentGuids) GetID() *string {
if o == nil {
return nil
}
return o.ID
}
type GetTopWatchedContentRole struct {
ID *int `json:"id,omitempty"`
Filter *string `json:"filter,omitempty"`
Tag *string `json:"tag,omitempty"`
TagKey *string `json:"tagKey,omitempty"`
Role *string `json:"role,omitempty"`
Thumb *string `json:"thumb,omitempty"`
}
func (o *GetTopWatchedContentRole) GetID() *int {
if o == nil {
return nil
}
return o.ID
}
func (o *GetTopWatchedContentRole) GetFilter() *string {
if o == nil {
return nil
}
return o.Filter
}
func (o *GetTopWatchedContentRole) GetTag() *string {
if o == nil {
return nil
}
return o.Tag
}
func (o *GetTopWatchedContentRole) GetTagKey() *string {
if o == nil {
return nil
}
return o.TagKey
}
func (o *GetTopWatchedContentRole) GetRole() *string {
if o == nil {
return nil
}
return o.Role
}
func (o *GetTopWatchedContentRole) GetThumb() *string {
if o == nil {
return nil
}
return o.Thumb
}
type User struct {
ID *int `json:"id,omitempty"`
}
func (o *User) GetID() *int {
if o == nil {
return nil
}
return o.ID
}
type GetTopWatchedContentMetadata struct {
RatingKey *string `json:"ratingKey,omitempty"`
Key *string `json:"key,omitempty"`
GUID *string `json:"guid,omitempty"`
Slug *string `json:"slug,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"`
Index *int64 `json:"index,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"`
LeafCount *int64 `json:"leafCount,omitempty"`
ViewedLeafCount *int64 `json:"viewedLeafCount,omitempty"`
ChildCount *int64 `json:"childCount,omitempty"`
AddedAt *int `json:"addedAt,omitempty"`
UpdatedAt *int `json:"updatedAt,omitempty"`
GlobalViewCount *int64 `json:"globalViewCount,omitempty"`
AudienceRatingImage *string `json:"audienceRatingImage,omitempty"`
Genre []GetTopWatchedContentGenre `json:"Genre,omitempty"`
Country []GetTopWatchedContentCountry `json:"Country,omitempty"`
Guids []GetTopWatchedContentGuids `json:"Guid,omitempty"`
Role []GetTopWatchedContentRole `json:"Role,omitempty"`
User []User `json:"User,omitempty"`
}
func (g GetTopWatchedContentMetadata) MarshalJSON() ([]byte, error) {
return utils.MarshalJSON(g, "", false)
}
func (g *GetTopWatchedContentMetadata) UnmarshalJSON(data []byte) error {
if err := utils.UnmarshalJSON(data, &g, "", false, false); err != nil {
return err
}
return nil
}
func (o *GetTopWatchedContentMetadata) GetRatingKey() *string {
if o == nil {
return nil
}
return o.RatingKey
}
func (o *GetTopWatchedContentMetadata) GetKey() *string {
if o == nil {
return nil
}
return o.Key
}
func (o *GetTopWatchedContentMetadata) GetGUID() *string {
if o == nil {
return nil
}
return o.GUID
}
func (o *GetTopWatchedContentMetadata) GetSlug() *string {
if o == nil {
return nil
}
return o.Slug
}
func (o *GetTopWatchedContentMetadata) GetStudio() *string {
if o == nil {
return nil
}
return o.Studio
}
func (o *GetTopWatchedContentMetadata) GetType() *string {
if o == nil {
return nil
}
return o.Type
}
func (o *GetTopWatchedContentMetadata) GetTitle() *string {
if o == nil {
return nil
}
return o.Title
}
func (o *GetTopWatchedContentMetadata) GetLibrarySectionTitle() *string {
if o == nil {
return nil
}
return o.LibrarySectionTitle
}
func (o *GetTopWatchedContentMetadata) GetLibrarySectionID() *int {
if o == nil {
return nil
}
return o.LibrarySectionID
}
func (o *GetTopWatchedContentMetadata) GetLibrarySectionKey() *string {
if o == nil {
return nil
}
return o.LibrarySectionKey
}
func (o *GetTopWatchedContentMetadata) GetContentRating() *string {
if o == nil {
return nil
}
return o.ContentRating
}
func (o *GetTopWatchedContentMetadata) GetSummary() *string {
if o == nil {
return nil
}
return o.Summary
}
func (o *GetTopWatchedContentMetadata) GetIndex() *int64 {
if o == nil {
return nil
}
return o.Index
}
func (o *GetTopWatchedContentMetadata) GetAudienceRating() *float64 {
if o == nil {
return nil
}
return o.AudienceRating
}
func (o *GetTopWatchedContentMetadata) GetYear() *int {
if o == nil {
return nil
}
return o.Year
}
func (o *GetTopWatchedContentMetadata) GetTagline() *string {
if o == nil {
return nil
}
return o.Tagline
}
func (o *GetTopWatchedContentMetadata) GetThumb() *string {
if o == nil {
return nil
}
return o.Thumb
}
func (o *GetTopWatchedContentMetadata) GetArt() *string {
if o == nil {
return nil
}
return o.Art
}
func (o *GetTopWatchedContentMetadata) GetDuration() *int {
if o == nil {
return nil
}
return o.Duration
}
func (o *GetTopWatchedContentMetadata) GetOriginallyAvailableAt() *types.Date {
if o == nil {
return nil
}
return o.OriginallyAvailableAt
}
func (o *GetTopWatchedContentMetadata) GetLeafCount() *int64 {
if o == nil {
return nil
}
return o.LeafCount
}
func (o *GetTopWatchedContentMetadata) GetViewedLeafCount() *int64 {
if o == nil {
return nil
}
return o.ViewedLeafCount
}
func (o *GetTopWatchedContentMetadata) GetChildCount() *int64 {
if o == nil {
return nil
}
return o.ChildCount
}
func (o *GetTopWatchedContentMetadata) GetAddedAt() *int {
if o == nil {
return nil
}
return o.AddedAt
}
func (o *GetTopWatchedContentMetadata) GetUpdatedAt() *int {
if o == nil {
return nil
}
return o.UpdatedAt
}
func (o *GetTopWatchedContentMetadata) GetGlobalViewCount() *int64 {
if o == nil {
return nil
}
return o.GlobalViewCount
}
func (o *GetTopWatchedContentMetadata) GetAudienceRatingImage() *string {
if o == nil {
return nil
}
return o.AudienceRatingImage
}
func (o *GetTopWatchedContentMetadata) GetGenre() []GetTopWatchedContentGenre {
if o == nil {
return nil
}
return o.Genre
}
func (o *GetTopWatchedContentMetadata) GetCountry() []GetTopWatchedContentCountry {
if o == nil {
return nil
}
return o.Country
}
func (o *GetTopWatchedContentMetadata) GetGuids() []GetTopWatchedContentGuids {
if o == nil {
return nil
}
return o.Guids
}
func (o *GetTopWatchedContentMetadata) GetRole() []GetTopWatchedContentRole {
if o == nil {
return nil
}
return o.Role
}
func (o *GetTopWatchedContentMetadata) GetUser() []User {
if o == nil {
return nil
}
return o.User
}
type GetTopWatchedContentMediaContainer struct {
Size *int `json:"size,omitempty"`
AllowSync *bool `json:"allowSync,omitempty"`
Identifier *string `json:"identifier,omitempty"`
MediaTagPrefix *string `json:"mediaTagPrefix,omitempty"`
MediaTagVersion *int `json:"mediaTagVersion,omitempty"`
Metadata []GetTopWatchedContentMetadata `json:"Metadata,omitempty"`
}
func (o *GetTopWatchedContentMediaContainer) GetSize() *int {
if o == nil {
return nil
}
return o.Size
}
func (o *GetTopWatchedContentMediaContainer) GetAllowSync() *bool {
if o == nil {
return nil
}
return o.AllowSync
}
func (o *GetTopWatchedContentMediaContainer) GetIdentifier() *string {
if o == nil {
return nil
}
return o.Identifier
}
func (o *GetTopWatchedContentMediaContainer) GetMediaTagPrefix() *string {
if o == nil {
return nil
}
return o.MediaTagPrefix
}
func (o *GetTopWatchedContentMediaContainer) GetMediaTagVersion() *int {
if o == nil {
return nil
}
return o.MediaTagVersion
}
func (o *GetTopWatchedContentMediaContainer) GetMetadata() []GetTopWatchedContentMetadata {
if o == nil {
return nil
}
return o.Metadata
}
// GetTopWatchedContentResponseBody - The metadata of the library item.
type GetTopWatchedContentResponseBody struct {
MediaContainer *GetTopWatchedContentMediaContainer `json:"MediaContainer,omitempty"`
}
func (o *GetTopWatchedContentResponseBody) GetMediaContainer() *GetTopWatchedContentMediaContainer {
if o == nil {
return nil
}
return o.MediaContainer
}
type GetTopWatchedContentResponse 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 metadata of the library item.
Object *GetTopWatchedContentResponseBody
}
func (o *GetTopWatchedContentResponse) GetContentType() string {
if o == nil {
return ""
}
return o.ContentType
}
func (o *GetTopWatchedContentResponse) GetStatusCode() int {
if o == nil {
return 0
}
return o.StatusCode
}
func (o *GetTopWatchedContentResponse) GetRawResponse() *http.Response {
if o == nil {
return nil
}
return o.RawResponse
}
func (o *GetTopWatchedContentResponse) GetObject() *GetTopWatchedContentResponseBody {
if o == nil {
return nil
}
return o.Object
}

View File

@@ -14,19 +14,19 @@ var GetWatchlistServerList = []string{
"https://metadata.provider.plex.tv", "https://metadata.provider.plex.tv",
} }
// Filter // PathParamFilter - Filter
type Filter string type PathParamFilter string
const ( const (
FilterAll Filter = "all" PathParamFilterAll PathParamFilter = "all"
FilterAvailable Filter = "available" PathParamFilterAvailable PathParamFilter = "available"
FilterReleased Filter = "released" PathParamFilterReleased PathParamFilter = "released"
) )
func (e Filter) ToPointer() *Filter { func (e PathParamFilter) ToPointer() *PathParamFilter {
return &e return &e
} }
func (e *Filter) UnmarshalJSON(data []byte) error { func (e *PathParamFilter) UnmarshalJSON(data []byte) error {
var v string var v string
if err := json.Unmarshal(data, &v); err != nil { if err := json.Unmarshal(data, &v); err != nil {
return err return err
@@ -37,10 +37,10 @@ func (e *Filter) UnmarshalJSON(data []byte) error {
case "available": case "available":
fallthrough fallthrough
case "released": case "released":
*e = Filter(v) *e = PathParamFilter(v)
return nil return nil
default: default:
return fmt.Errorf("invalid value for Filter: %v", v) return fmt.Errorf("invalid value for PathParamFilter: %v", v)
} }
} }
@@ -127,7 +127,7 @@ func (e *IncludeExternalMedia) UnmarshalJSON(data []byte) error {
type GetWatchlistRequest struct { type GetWatchlistRequest struct {
// Filter // Filter
Filter Filter `pathParam:"style=simple,explode=false,name=filter"` Filter PathParamFilter `pathParam:"style=simple,explode=false,name=filter"`
// In the format "field:dir". Available fields are "watchlistedAt" (Added At), // In the format "field:dir". Available fields are "watchlistedAt" (Added At),
// "titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating). // "titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating).
// "dir" can be "asc" or "desc" // "dir" can be "asc" or "desc"
@@ -158,9 +158,9 @@ type GetWatchlistRequest struct {
XPlexContainerSize *int `queryParam:"style=form,explode=true,name=X-Plex-Container-Size"` XPlexContainerSize *int `queryParam:"style=form,explode=true,name=X-Plex-Container-Size"`
} }
func (o *GetWatchlistRequest) GetFilter() Filter { func (o *GetWatchlistRequest) GetFilter() PathParamFilter {
if o == nil { if o == nil {
return Filter("") return PathParamFilter("")
} }
return o.Filter return o.Filter
} }

View File

@@ -419,7 +419,7 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, request operations.Delet
httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
switch { switch {
case httpRes.StatusCode == 200: case httpRes.StatusCode == 204:
fallthrough fallthrough
case httpRes.StatusCode == 400: case httpRes.StatusCode == 400:
case httpRes.StatusCode == 401: case httpRes.StatusCode == 401:

View File

@@ -163,7 +163,6 @@ func WithServerIndex(serverIndex int) SDKOption {
} }
} }
// ServerProtocol - The protocol to use when connecting to your plex server.
type ServerProtocol string type ServerProtocol string
const ( const (
@@ -255,7 +254,7 @@ func WithSecuritySource(security func(context.Context) (shared.Security, error))
// WithXPlexClientIdentifier allows setting the XPlexClientIdentifier parameter for all supported operations // WithXPlexClientIdentifier allows setting the XPlexClientIdentifier parameter for all supported operations
func WithXPlexClientIdentifier(xPlexClientIdentifier string) SDKOption { func WithXPlexClientIdentifier(xPlexClientIdentifier string) SDKOption {
return func(sdk *PlexAPI) { return func(sdk *PlexAPI) {
sdk.sdkConfiguration.Globals.XPlexClientIdentifier = xPlexClientIdentifier sdk.sdkConfiguration.Globals.XPlexClientIdentifier = &xPlexClientIdentifier
} }
} }
@@ -272,8 +271,8 @@ func New(opts ...SDKOption) *PlexAPI {
Language: "go", Language: "go",
OpenAPIDocVersion: "0.0.3", OpenAPIDocVersion: "0.0.3",
SDKVersion: "0.0.1", SDKVersion: "0.0.1",
GenVersion: "2.342.6", GenVersion: "2.349.6",
UserAgent: "speakeasy-sdk/go 0.0.1 2.342.6 0.0.3 github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk", UserAgent: "speakeasy-sdk/go 0.0.1 2.349.6 0.0.3 github.com/LukeHagar/terraform-provider-PlexAPI/internal/sdk",
Globals: globals.Globals{}, Globals: globals.Globals{},
ServerDefaults: []map[string]string{ ServerDefaults: []map[string]string{
{ {

View File

@@ -26,8 +26,8 @@ func newServer(sdkConfig sdkConfiguration) *Server {
} }
} }
// GetServerCapabilities - Server Capabilities // GetServerCapabilities - Get Server Capabilities
// Server Capabilities // Get Server Capabilities
func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServerCapabilitiesResponse, error) { func (s *Server) GetServerCapabilities(ctx context.Context) (*operations.GetServerCapabilitiesResponse, error) {
hookCtx := hooks.HookContext{ hookCtx := hooks.HookContext{
Context: ctx, Context: ctx,

View File

@@ -131,7 +131,7 @@ func (s *Sessions) GetSessions(ctx context.Context) (*operations.GetSessionsResp
// GetSessionHistory - Get Session History // GetSessionHistory - Get Session History
// This will Retrieve a listing of all history views. // This will Retrieve a listing of all history views.
func (s *Sessions) GetSessionHistory(ctx context.Context) (*operations.GetSessionHistoryResponse, error) { func (s *Sessions) GetSessionHistory(ctx context.Context, request operations.GetSessionHistoryRequest) (*operations.GetSessionHistoryResponse, error) {
hookCtx := hooks.HookContext{ hookCtx := hooks.HookContext{
Context: ctx, Context: ctx,
OperationID: "getSessionHistory", OperationID: "getSessionHistory",
@@ -152,6 +152,10 @@ func (s *Sessions) GetSessionHistory(ctx context.Context) (*operations.GetSessio
req.Header.Set("Accept", "application/json") req.Header.Set("Accept", "application/json")
req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) 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 { if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil {
return nil, err return nil, err
} }

View File

@@ -132,3 +132,217 @@ func (s *Statistics) GetStatistics(ctx context.Context, request operations.GetSt
return res, nil return res, nil
} }
// GetResourcesStatistics - Get Resources Statistics
// This will return the resources for the server
func (s *Statistics) GetResourcesStatistics(ctx context.Context, request operations.GetResourcesStatisticsRequest) (*operations.GetResourcesStatisticsResponse, error) {
hookCtx := hooks.HookContext{
Context: ctx,
OperationID: "getResourcesStatistics",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}
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)
}
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.GetResourcesStatisticsResponse{
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.GetResourcesStatisticsResponseBody
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.GetResourcesStatisticsStatisticsResponseBody
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
}
// GetBandwidthStatistics - Get Bandwidth Statistics
// This will return the bandwidth statistics for the server
func (s *Statistics) GetBandwidthStatistics(ctx context.Context, request operations.GetBandwidthStatisticsRequest) (*operations.GetBandwidthStatisticsResponse, error) {
hookCtx := hooks.HookContext{
Context: ctx,
OperationID: "getBandwidthStatistics",
OAuth2Scopes: []string{},
SecuritySource: s.sdkConfiguration.Security,
}
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)
}
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.GetBandwidthStatisticsResponse{
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.GetBandwidthStatisticsResponseBody
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.GetBandwidthStatisticsStatisticsResponseBody
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
}