Compare commits

...

1 Commits

Author SHA1 Message Date
speakeasybot
b3ac2d0c2e ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.150.0 2024-01-23 20:47:32 +00:00
25 changed files with 753 additions and 104 deletions

View File

@@ -1,12 +1,12 @@
lockVersion: 2.0.0 lockVersion: 2.0.0
id: dfa99515-01c0-42eb-9be5-ee212fd03eb3 id: dfa99515-01c0-42eb-9be5-ee212fd03eb3
management: management:
docChecksum: 7aba498c024534142941d65a7c2e649c docChecksum: 49e77b550f057eb568502dc74fee7cce
docVersion: 0.0.3 docVersion: 0.0.3
speakeasyVersion: internal speakeasyVersion: internal
generationVersion: 2.237.3 generationVersion: 2.237.3
releaseVersion: 0.1.1 releaseVersion: 0.1.2
configChecksum: 75ea35f7a212ecc077e24de582ed767e configChecksum: 6e7156b73170398db5f73b78a4f03b59
repoURL: https://github.com/LukeHagar/plexgo.git repoURL: https://github.com/LukeHagar/plexgo.git
repoSubDirectory: . repoSubDirectory: .
installationURL: https://github.com/LukeHagar/plexgo installationURL: https://github.com/LukeHagar/plexgo
@@ -83,6 +83,7 @@ generatedFiles:
- /models/operations/deletelibrary.go - /models/operations/deletelibrary.go
- /models/operations/getlibraryitems.go - /models/operations/getlibraryitems.go
- /models/operations/refreshlibrary.go - /models/operations/refreshlibrary.go
- /models/operations/searchlibrary.go
- /models/operations/getmetadata.go - /models/operations/getmetadata.go
- /models/operations/getmetadatachildren.go - /models/operations/getmetadatachildren.go
- /models/operations/getondeck.go - /models/operations/getondeck.go
@@ -308,6 +309,12 @@ generatedFiles:
- docs/models/operations/getlibraryitemsresponse.md - docs/models/operations/getlibraryitemsresponse.md
- docs/models/operations/refreshlibraryrequest.md - docs/models/operations/refreshlibraryrequest.md
- docs/models/operations/refreshlibraryresponse.md - docs/models/operations/refreshlibraryresponse.md
- docs/models/operations/type.md
- docs/models/operations/searchlibraryrequest.md
- docs/models/operations/searchlibrarymetadata.md
- docs/models/operations/searchlibrarymediacontainer.md
- docs/models/operations/searchlibraryresponsebody.md
- docs/models/operations/searchlibraryresponse.md
- docs/models/operations/getmetadatarequest.md - docs/models/operations/getmetadatarequest.md
- docs/models/operations/stream.md - docs/models/operations/stream.md
- docs/models/operations/getmetadatapart.md - docs/models/operations/getmetadatapart.md
@@ -343,7 +350,7 @@ generatedFiles:
- docs/models/operations/loglineresponse.md - docs/models/operations/loglineresponse.md
- docs/models/operations/logmultilineresponse.md - docs/models/operations/logmultilineresponse.md
- docs/models/operations/enablepapertrailresponse.md - docs/models/operations/enablepapertrailresponse.md
- docs/models/operations/type.md - docs/models/operations/queryparamtype.md
- docs/models/operations/smart.md - docs/models/operations/smart.md
- docs/models/operations/createplaylistrequest.md - docs/models/operations/createplaylistrequest.md
- docs/models/operations/createplaylistmetadata.md - docs/models/operations/createplaylistmetadata.md
@@ -388,7 +395,7 @@ generatedFiles:
- docs/models/operations/force.md - docs/models/operations/force.md
- docs/models/operations/uploadplaylistrequest.md - docs/models/operations/uploadplaylistrequest.md
- docs/models/operations/uploadplaylistresponse.md - docs/models/operations/uploadplaylistresponse.md
- docs/models/operations/queryparamtype.md - docs/models/operations/gettransienttokenqueryparamtype.md
- docs/models/operations/scope.md - docs/models/operations/scope.md
- docs/models/operations/gettransienttokenrequest.md - docs/models/operations/gettransienttokenrequest.md
- docs/models/operations/gettransienttokenresponse.md - docs/models/operations/gettransienttokenresponse.md

View File

@@ -102,6 +102,7 @@ func main() {
* [DeleteLibrary](docs/sdks/library/README.md#deletelibrary) - Delete Library Section * [DeleteLibrary](docs/sdks/library/README.md#deletelibrary) - Delete Library Section
* [GetLibraryItems](docs/sdks/library/README.md#getlibraryitems) - Get Library Items * [GetLibraryItems](docs/sdks/library/README.md#getlibraryitems) - Get Library Items
* [RefreshLibrary](docs/sdks/library/README.md#refreshlibrary) - Refresh Library * [RefreshLibrary](docs/sdks/library/README.md#refreshlibrary) - Refresh Library
* [SearchLibrary](docs/sdks/library/README.md#searchlibrary) - Search Library
* [GetMetadata](docs/sdks/library/README.md#getmetadata) - Get Items Metadata * [GetMetadata](docs/sdks/library/README.md#getmetadata) - Get Items Metadata
* [GetMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children * [GetMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children
* [GetOnDeck](docs/sdks/library/README.md#getondeck) - Get On Deck * [GetOnDeck](docs/sdks/library/README.md#getondeck) - Get On Deck

View File

@@ -69,3 +69,13 @@ Based on:
- [go v0.1.1] . - [go v0.1.1] .
### Releases ### Releases
- [Go v0.1.1] https://github.com/LukeHagar/plexgo/releases/tag/v0.1.1 - . - [Go v0.1.1] https://github.com/LukeHagar/plexgo/releases/tag/v0.1.1 - .
## 2024-01-23 20:47:20
### Changes
Based on:
- OpenAPI Doc 0.0.3
- Speakeasy CLI 1.150.0 (2.237.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.1.2] .
### Releases
- [Go v0.1.2] https://github.com/LukeHagar/plexgo/releases/tag/v0.1.2 - .

View File

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

View File

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

View File

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

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
# SearchLibraryResponse
## Fields
| Field | Type | Required | Description |
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation |
| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation |
| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing |
| `Object` | [*operations.SearchLibraryResponseBody](../../models/operations/searchlibraryresponsebody.md) | :heavy_minus_sign: | The contents of the library by section and type |

View File

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

View File

@@ -6,7 +6,7 @@ A key representing a specific tag within the section.
## Values ## Values
| Name | Value | | Name | Value |
| --------------------- | --------------------- | | ------------------- | ------------------- |
| `TagAll` | all | | `TagAll` | all |
| `TagUnwatched` | unwatched | | `TagUnwatched` | unwatched |
| `TagNewest` | newest | | `TagNewest` | newest |
@@ -26,4 +26,3 @@ A key representing a specific tag within the section.
| `TagResolution` | resolution | | `TagResolution` | resolution |
| `TagFirstCharacter` | firstCharacter | | `TagFirstCharacter` | firstCharacter |
| `TagFolder` | folder | | `TagFolder` | folder |
| `TagSearchTypeEqual1` | search?type=1 |

View File

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

View File

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

View File

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

View File

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

View File

@@ -8,7 +8,7 @@ generation:
fixes: fixes:
nameResolutionDec2023: false nameResolutionDec2023: false
go: go:
version: 0.1.1 version: 0.1.2
clientServerStatusCodesAsErrors: true clientServerStatusCodesAsErrors: true
flattenGlobalSecurity: true flattenGlobalSecurity: true
imports: imports:

View File

@@ -465,7 +465,6 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionID float64) (*operat
// - `resolution`: Items categorized by resolution. // - `resolution`: Items categorized by resolution.
// - `firstCharacter`: Items categorized by the first letter. // - `firstCharacter`: Items categorized by the first letter.
// - `folder`: Items categorized by folder. // - `folder`: Items categorized by folder.
// - `search?type=1`: Search functionality within the section.
func (s *Library) GetLibraryItems(ctx context.Context, sectionID int64, tag operations.Tag) (*operations.GetLibraryItemsResponse, error) { func (s *Library) GetLibraryItems(ctx context.Context, sectionID int64, tag operations.Tag) (*operations.GetLibraryItemsResponse, error) {
request := operations.GetLibraryItemsRequest{ request := operations.GetLibraryItemsRequest{
SectionID: sectionID, SectionID: sectionID,
@@ -601,6 +600,94 @@ func (s *Library) RefreshLibrary(ctx context.Context, sectionID float64) (*opera
return res, nil return res, nil
} }
// SearchLibrary - Search Library
// Search for content within a specific section of the library.
//
// ### Types
// Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls:
//
// - **Type Object Attributes**:
// - `type`: Metadata type (if standard Plex type).
// - `title`: Title for this content type (e.g., "Movies").
//
// - **Filter Objects**:
// - Subset of the media query language.
// - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`.
//
// - **Sort Objects**:
// - Description of sort fields.
// - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`.
//
// > **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
func (s *Library) SearchLibrary(ctx context.Context, sectionID int64, type_ operations.Type) (*operations.SearchLibraryResponse, error) {
request := operations.SearchLibraryRequest{
SectionID: sectionID,
Type: type_,
}
baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails())
url, err := utils.GenerateURL(ctx, baseURL, "/library/sections/{sectionId}/search", request, nil)
if err != nil {
return nil, fmt.Errorf("error generating URL: %w", err)
}
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
if err != nil {
return nil, fmt.Errorf("error creating request: %w", err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("user-agent", s.sdkConfiguration.UserAgent)
if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil {
return nil, fmt.Errorf("error populating query params: %w", err)
}
client := s.sdkConfiguration.SecurityClient
httpRes, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("error sending request: %w", err)
}
if httpRes == nil {
return nil, fmt.Errorf("error sending request: no response")
}
contentType := httpRes.Header.Get("Content-Type")
res := &operations.SearchLibraryResponse{
StatusCode: httpRes.StatusCode,
ContentType: contentType,
RawResponse: httpRes,
}
rawBody, err := io.ReadAll(httpRes.Body)
if err != nil {
return nil, fmt.Errorf("error reading response body: %w", err)
}
httpRes.Body.Close()
httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody))
switch {
case httpRes.StatusCode == 200:
switch {
case utils.MatchContentType(contentType, `application/json`):
var out operations.SearchLibraryResponseBody
if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil {
return nil, err
}
res.Object = &out
default:
return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", contentType), httpRes.StatusCode, string(rawBody), httpRes)
}
case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500:
fallthrough
case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600:
return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes)
}
return res, nil
}
// GetMetadata - Get Items Metadata // GetMetadata - Get Items Metadata
// This endpoint will return the metadata of a library item specified with the ratingKey. // This endpoint will return the metadata of a library item specified with the ratingKey.
func (s *Library) GetMetadata(ctx context.Context, ratingKey float64) (*operations.GetMetadataResponse, error) { func (s *Library) GetMetadata(ctx context.Context, ratingKey float64) (*operations.GetMetadataResponse, error) {

View File

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

View File

@@ -33,7 +33,6 @@ const (
TagResolution Tag = "resolution" TagResolution Tag = "resolution"
TagFirstCharacter Tag = "firstCharacter" TagFirstCharacter Tag = "firstCharacter"
TagFolder Tag = "folder" TagFolder Tag = "folder"
TagSearchTypeEqual1 Tag = "search?type=1"
) )
func (e Tag) ToPointer() *Tag { func (e Tag) ToPointer() *Tag {
@@ -83,8 +82,6 @@ func (e *Tag) UnmarshalJSON(data []byte) error {
case "firstCharacter": case "firstCharacter":
fallthrough fallthrough
case "folder": case "folder":
fallthrough
case "search?type=1":
*e = Tag(v) *e = Tag(v)
return nil return nil
default: default:

View File

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

View File

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

View File

@@ -251,9 +251,9 @@ func New(opts ...SDKOption) *PlexAPI {
sdkConfiguration: sdkConfiguration{ sdkConfiguration: sdkConfiguration{
Language: "go", Language: "go",
OpenAPIDocVersion: "0.0.3", OpenAPIDocVersion: "0.0.3",
SDKVersion: "0.1.1", SDKVersion: "0.1.2",
GenVersion: "2.237.3", GenVersion: "2.237.3",
UserAgent: "speakeasy-sdk/go 0.1.1 2.237.3 0.0.3 github.com/LukeHagar/plexgo", UserAgent: "speakeasy-sdk/go 0.1.2 2.237.3 0.0.3 github.com/LukeHagar/plexgo",
ServerDefaults: []map[string]string{ ServerDefaults: []map[string]string{
{ {
"protocol": "http", "protocol": "http",

View File

@@ -27,7 +27,7 @@ func newSecurity(sdkConfig sdkConfiguration) *Security {
// GetTransientToken - Get a Transient Token. // GetTransientToken - Get a Transient Token.
// This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted. // This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted.
func (s *Security) GetTransientToken(ctx context.Context, type_ operations.QueryParamType, scope operations.Scope) (*operations.GetTransientTokenResponse, error) { func (s *Security) GetTransientToken(ctx context.Context, type_ operations.GetTransientTokenQueryParamType, scope operations.Scope) (*operations.GetTransientTokenResponse, error) {
request := operations.GetTransientTokenRequest{ request := operations.GetTransientTokenRequest{
Type: type_, Type: type_,
Scope: scope, Scope: scope,