Skip to content

Commit

Permalink
Merge pull request #1 from LukeHagar/speakeasy-sdk-regen-1726512199
Browse files Browse the repository at this point in the history
chore: 🐝 Update SDK - Generate 0.8.0
  • Loading branch information
LukeHagar authored Sep 16, 2024
2 parents 19c1b25 + b16d070 commit 9130d39
Show file tree
Hide file tree
Showing 1,510 changed files with 37,385 additions and 13,167 deletions.
3,400 changes: 2,474 additions & 926 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ generation:
auth:
oAuth2ClientCredentialsEnabled: false
php:
version: 0.7.0
version: 0.8.0
clientServerStatusCodesAsErrors: true
flattenGlobalSecurity: true
imports:
Expand Down
34 changes: 21 additions & 13 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
speakeasyVersion: 1.362.0
speakeasyVersion: 1.397.2
sources:
my-source:
sourceNamespace: my-source
Expand All @@ -7,29 +7,37 @@ sources:
tags:
- latest
- main
plexapi:
sourceNamespace: plexapi
sourceRevisionDigest: sha256:533fe97486e3fe2d84e890b7bbcdba4543d415e45181386154e011861f6da36f
sourceBlobDigest: sha256:f7e2709f52370dff16c1851a7a4e44a89f2e978e9cae335bffc10625950b3bd9
tags:
- latest
- main
targets:
plexphp:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:c655e586ae918fdfeb2a0e48f44dd0d83a60834c56b12cda70cc1b6e41a30680
sourceBlobDigest: sha256:e7c91bb1aed0f6cc3284fef94ec096c89c1c88c5a256ca9d0d032de67180fdd8
source: plexapi
sourceNamespace: plexapi
sourceRevisionDigest: sha256:533fe97486e3fe2d84e890b7bbcdba4543d415e45181386154e011861f6da36f
sourceBlobDigest: sha256:f7e2709f52370dff16c1851a7a4e44a89f2e978e9cae335bffc10625950b3bd9
codeSamplesNamespace: code-samples-php-plexphp
codeSamplesRevisionDigest: sha256:b7885c14977a7f51b434eba5a7fa83a28455dfa4bfd20a8ab04319dfbace7417
outLocation: /github/workspace/repo
codeSamplesRevisionDigest: sha256:09c3a7a54c93941a76a6e929193153781dfd0468455ab492b9650f410d8e8c4c
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
my-source:
plexapi:
inputs:
- location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/plex-media-server-spec-dereferenced.yaml
registry:
location: registry.speakeasyapi.dev/lukehagar/lukehagar/my-source
- location: registry.speakeasyapi.dev/plexapi/plexapi/plexapi:main
targets:
plexphp:
target: php
source: my-source
source: plexapi
publish:
packagist:
username: LukeHagar
token: $packagist_token
codeSamples:
output: codeSamples.yaml
registry:
location: registry.speakeasyapi.dev/lukehagar/lukehagar/code-samples-php-plexphp
location: registry.speakeasyapi.dev/plexapi/plexapi/code-samples-php-plexphp
221 changes: 146 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,30 @@
</a>
</div>

<!-- Start SDK Installation [installation] -->
## SDK Installation
<!-- Start Summary [summary] -->
## Summary

### Composer
Plex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server
<!-- End Summary [summary] -->

To install the SDK first add the below to your `composer.json` file:
<!-- Start Table of Contents [toc] -->
## Table of Contents

```json
{
"repositories": [
{
"type": "github",
"url": "https://github.com/LukeHagar/plexphp.git"
}
],
"require": {
"lukehagar/plex-api": "*"
}
}
```
* [SDK Installation](#sdk-installation)
* [SDK Example Usage](#sdk-example-usage)
* [Available Resources and Operations](#available-resources-and-operations)
* [Global Parameters](#global-parameters)
* [Server Selection](#server-selection)
<!-- End Table of Contents [toc] -->

<!-- Start SDK Installation [installation] -->
## SDK Installation

Then run the following command:
The SDK relies on [Composer](https://getcomposer.org/) to manage its dependencies.

To install the SDK and add it as a dependency to an existing `composer.json` file:
```bash
composer update
composer require "lukehagar/plex-api"
```
<!-- End SDK Installation [installation] -->

Expand All @@ -48,11 +47,12 @@ require 'vendor/autoload.php';
use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Components;

$security = new Components\Security();
$security->accessToken = '<YOUR_API_KEY_HERE>';
$security = new Components\Security(
accessToken: "<YOUR_API_KEY_HERE>",
);

$sdk = Plex_API\PlexAPI::builder()
->setXPlexClientIdentifier('Postman')
->setXPlexClientIdentifier('gcgzw5rz2xovp84b4vha3a40')
->setSecurity($security)->build();

try {
Expand All @@ -70,33 +70,21 @@ try {
<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations

### [Server](docs/sdks/server/README.md)

* [getServerCapabilities](docs/sdks/server/README.md#getservercapabilities) - Get Server Capabilities
* [getServerPreferences](docs/sdks/server/README.md#getserverpreferences) - Get Server Preferences
* [getAvailableClients](docs/sdks/server/README.md#getavailableclients) - Get Available Clients
* [getDevices](docs/sdks/server/README.md#getdevices) - Get Devices
* [getServerIdentity](docs/sdks/server/README.md#getserveridentity) - Get Server Identity
* [getMyPlexAccount](docs/sdks/server/README.md#getmyplexaccount) - Get MyPlex Account
* [getResizedPhoto](docs/sdks/server/README.md#getresizedphoto) - Get a Resized Photo
* [getServerList](docs/sdks/server/README.md#getserverlist) - Get Server List

### [Media](docs/sdks/media/README.md)

* [markPlayed](docs/sdks/media/README.md#markplayed) - Mark Media Played
* [markUnplayed](docs/sdks/media/README.md#markunplayed) - Mark Media Unplayed
* [updatePlayProgress](docs/sdks/media/README.md#updateplayprogress) - Update Media Play Progress

### [Video](docs/sdks/video/README.md)

* [getTimeline](docs/sdks/video/README.md#gettimeline) - Get the timeline for a media item
* [startUniversalTranscode](docs/sdks/video/README.md#startuniversaltranscode) - Start Universal Transcode
<details open>
<summary>Available methods</summary>

### [Activities](docs/sdks/activities/README.md)

* [getServerActivities](docs/sdks/activities/README.md#getserveractivities) - Get Server Activities
* [cancelServerActivities](docs/sdks/activities/README.md#cancelserveractivities) - Cancel Server Activities

### [Authentication](docs/sdks/authentication/README.md)

* [getTransientToken](docs/sdks/authentication/README.md#gettransienttoken) - Get a Transient Token
* [getSourceConnectionInformation](docs/sdks/authentication/README.md#getsourceconnectioninformation) - Get Source Connection Information
* [getTokenDetails](docs/sdks/authentication/README.md#gettokendetails) - Get Token Details
* [postUsersSignInData](docs/sdks/authentication/README.md#postuserssignindata) - Get User Sign In Data

### [Butler](docs/sdks/butler/README.md)

* [getButlerTasks](docs/sdks/butler/README.md#getbutlertasks) - Get Butler tasks
Expand All @@ -105,34 +93,22 @@ try {
* [startTask](docs/sdks/butler/README.md#starttask) - Start a single Butler task
* [stopTask](docs/sdks/butler/README.md#stoptask) - Stop a single Butler task

### [Plex](docs/sdks/plex/README.md)

* [getHomeData](docs/sdks/plex/README.md#gethomedata) - Get Plex Home Data
* [getPin](docs/sdks/plex/README.md#getpin) - Get a Pin
* [getToken](docs/sdks/plex/README.md#gettoken) - Get Access Token

### [Hubs](docs/sdks/hubs/README.md)

* [getGlobalHubs](docs/sdks/hubs/README.md#getglobalhubs) - Get Global Hubs
* [getLibraryHubs](docs/sdks/hubs/README.md#getlibraryhubs) - Get library specific hubs

### [Search](docs/sdks/search/README.md)

* [performSearch](docs/sdks/search/README.md#performsearch) - Perform a search
* [performVoiceSearch](docs/sdks/search/README.md#performvoicesearch) - Perform a voice search
* [getSearchResults](docs/sdks/search/README.md#getsearchresults) - Get Search Results

### [Library](docs/sdks/library/README.md)

* [getFileHash](docs/sdks/library/README.md#getfilehash) - Get Hash Value
* [getRecentlyAdded](docs/sdks/library/README.md#getrecentlyadded) - Get Recently Added
* [getLibraries](docs/sdks/library/README.md#getlibraries) - Get All Libraries
* [getLibrary](docs/sdks/library/README.md#getlibrary) - Get Library Details
* [getAllLibraries](docs/sdks/library/README.md#getalllibraries) - Get All Libraries
* [getLibraryDetails](docs/sdks/library/README.md#getlibrarydetails) - Get Library Details
* [deleteLibrary](docs/sdks/library/README.md#deletelibrary) - Delete Library Section
* [getLibraryItems](docs/sdks/library/README.md#getlibraryitems) - Get Library Items
* [refreshLibrary](docs/sdks/library/README.md#refreshlibrary) - Refresh Library
* [searchLibrary](docs/sdks/library/README.md#searchlibrary) - Search Library
* [getMetadata](docs/sdks/library/README.md#getmetadata) - Get Items Metadata
* [getRefreshLibraryMetadata](docs/sdks/library/README.md#getrefreshlibrarymetadata) - Refresh Metadata Of The Library
* [getSearchLibrary](docs/sdks/library/README.md#getsearchlibrary) - Search Library
* [getMetaDataByRatingKey](docs/sdks/library/README.md#getmetadatabyratingkey) - Get Metadata by RatingKey
* [getMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children
* [getTopWatchedContent](docs/sdks/library/README.md#gettopwatchedcontent) - Get Top Watched Content
* [getOnDeck](docs/sdks/library/README.md#getondeck) - Get On Deck
Expand All @@ -143,6 +119,14 @@ try {
* [logMultiLine](docs/sdks/log/README.md#logmultiline) - Logging a multi-line message
* [enablePaperTrail](docs/sdks/log/README.md#enablepapertrail) - Enabling Papertrail

### [Media](docs/sdks/media/README.md)

* [markPlayed](docs/sdks/media/README.md#markplayed) - Mark Media Played
* [markUnplayed](docs/sdks/media/README.md#markunplayed) - Mark Media Unplayed
* [updatePlayProgress](docs/sdks/media/README.md#updateplayprogress) - Update Media Play Progress
* [getBannerImage](docs/sdks/media/README.md#getbannerimage) - Get Banner Image
* [getThumbImage](docs/sdks/media/README.md#getthumbimage) - Get Thumb Image

### [Playlists](docs/sdks/playlists/README.md)

* [createPlaylist](docs/sdks/playlists/README.md#createplaylist) - Create a Playlist
Expand All @@ -155,16 +139,34 @@ try {
* [addPlaylistContents](docs/sdks/playlists/README.md#addplaylistcontents) - Adding to a Playlist
* [uploadPlaylist](docs/sdks/playlists/README.md#uploadplaylist) - Upload Playlist

### [Authentication](docs/sdks/authentication/README.md)
### [Plex](docs/sdks/plex/README.md)

* [getTransientToken](docs/sdks/authentication/README.md#gettransienttoken) - Get a Transient Token.
* [getSourceConnectionInformation](docs/sdks/authentication/README.md#getsourceconnectioninformation) - Get Source Connection Information
* [getCompanionsData](docs/sdks/plex/README.md#getcompanionsdata) - Get Companions Data
* [getUserFriends](docs/sdks/plex/README.md#getuserfriends) - Get list of friends of the user logged in
* [getGeoData](docs/sdks/plex/README.md#getgeodata) - Get Geo Data
* [getHomeData](docs/sdks/plex/README.md#gethomedata) - Get Plex Home Data
* [getServerResources](docs/sdks/plex/README.md#getserverresources) - Get Server Resources
* [getPin](docs/sdks/plex/README.md#getpin) - Get a Pin
* [getTokenByPinId](docs/sdks/plex/README.md#gettokenbypinid) - Get Access Token by PinId

### [Statistics](docs/sdks/statistics/README.md)

* [getStatistics](docs/sdks/statistics/README.md#getstatistics) - Get Media Statistics
* [getResourcesStatistics](docs/sdks/statistics/README.md#getresourcesstatistics) - Get Resources Statistics
* [getBandwidthStatistics](docs/sdks/statistics/README.md#getbandwidthstatistics) - Get Bandwidth Statistics
### [Search](docs/sdks/search/README.md)

* [performSearch](docs/sdks/search/README.md#performsearch) - Perform a search
* [performVoiceSearch](docs/sdks/search/README.md#performvoicesearch) - Perform a voice search
* [getSearchResults](docs/sdks/search/README.md#getsearchresults) - Get Search Results

### [Server](docs/sdks/server/README.md)

* [getServerCapabilities](docs/sdks/server/README.md#getservercapabilities) - Get Server Capabilities
* [getServerPreferences](docs/sdks/server/README.md#getserverpreferences) - Get Server Preferences
* [getAvailableClients](docs/sdks/server/README.md#getavailableclients) - Get Available Clients
* [getDevices](docs/sdks/server/README.md#getdevices) - Get Devices
* [getServerIdentity](docs/sdks/server/README.md#getserveridentity) - Get Server Identity
* [getMyPlexAccount](docs/sdks/server/README.md#getmyplexaccount) - Get MyPlex Account
* [getResizedPhoto](docs/sdks/server/README.md#getresizedphoto) - Get a Resized Photo
* [getMediaProviders](docs/sdks/server/README.md#getmediaproviders) - Get Media Providers
* [getServerList](docs/sdks/server/README.md#getserverlist) - Get Server List

### [Sessions](docs/sdks/sessions/README.md)

Expand All @@ -173,17 +175,82 @@ try {
* [getTranscodeSessions](docs/sdks/sessions/README.md#gettranscodesessions) - Get Transcode Sessions
* [stopTranscodeSession](docs/sdks/sessions/README.md#stoptranscodesession) - Stop a Transcode Session

### [Statistics](docs/sdks/statistics/README.md)

* [getStatistics](docs/sdks/statistics/README.md#getstatistics) - Get Media Statistics
* [getResourcesStatistics](docs/sdks/statistics/README.md#getresourcesstatistics) - Get Resources Statistics
* [getBandwidthStatistics](docs/sdks/statistics/README.md#getbandwidthstatistics) - Get Bandwidth Statistics

### [Updater](docs/sdks/updater/README.md)

* [getUpdateStatus](docs/sdks/updater/README.md#getupdatestatus) - Querying status of updates
* [checkForUpdates](docs/sdks/updater/README.md#checkforupdates) - Checking for updates
* [applyUpdates](docs/sdks/updater/README.md#applyupdates) - Apply Updates

### [Video](docs/sdks/video/README.md)

* [getTimeline](docs/sdks/video/README.md#gettimeline) - Get the timeline for a media item
* [startUniversalTranscode](docs/sdks/video/README.md#startuniversaltranscode) - Start Universal Transcode

### [Watchlist](docs/sdks/watchlist/README.md)

* [getWatchlist](docs/sdks/watchlist/README.md#getwatchlist) - Get User Watchlist
* [getWatchList](docs/sdks/watchlist/README.md#getwatchlist) - Get User Watchlist

</details>
<!-- End Available Resources and Operations [operations] -->

<!-- Start Global Parameters [global-parameters] -->
## Global Parameters

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 `'gcgzw5rz2xovp84b4vha3a40'` at SDK initialization and then you do not have to pass the same value on calls to operations like `getServerResources`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.


### Available Globals

The following global parameter is available.

| Name | Type | Required | Description |
| ---- | ---- |:--------:| ----------- |
| xPlexClientIdentifier | string | | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
|


### Example

```php
declare(strict_types=1);

require 'vendor/autoload.php';

use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Components;
use LukeHagar\Plex_API\Models\Operations;

$security = new Components\Security(
accessToken: "<YOUR_API_KEY_HERE>",
);

$sdk = Plex_API\PlexAPI::builder()
->setXPlexClientIdentifier('gcgzw5rz2xovp84b4vha3a40')
->setSecurity($security)->build();

try {

$response = $sdk->plex->getServerResources('gcgzw5rz2xovp84b4vha3a40', Operations\IncludeHttps::One, Operations\IncludeRelay::One, Operations\IncludeIPv6::One);

if ($response->plexDevices !== null) {
// handle response
}
} catch (Throwable $e) {
// handle exception
}
```
<!-- End Global Parameters [global-parameters] -->

<!-- Start Server Selection [server] -->
## Server Selection

Expand All @@ -195,14 +262,14 @@ You can override the default server globally by passing a server index to the `s

| # | Server | Variables |
| - | ------ | --------- |
| 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `http`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) |
| 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `https`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) |



#### Variables

Some of the server options above contain variables. If you want to set the values of those variables, the following optional parameters are available when initializing the SDK client instance:
* `protocol: ServerProtocol`
* `protocol: Plex_API\ServerProtocol`
* `ip: string`
* `port: string`

Expand All @@ -220,16 +287,20 @@ declare(strict_types=1);
require 'vendor/autoload.php';

use LukeHagar\Plex_API;
use LukeHagar\Plex_API\Models\Components;

$security = new Components\Security(
accessToken: "<YOUR_API_KEY_HERE>",
);

$sdk = Plex_API\PlexAPI::builder()
->setXPlexClientIdentifier('Postman')
->build();
->setXPlexClientIdentifier('gcgzw5rz2xovp84b4vha3a40')
->setSecurity($security)->build();

try {
$response = $sdk->plex->getCompanionsData("https://plex.tv/api/v2/");

$response = $sdk->plex->getPin("https://plex.tv/api/v2", 'Postman', false, 'Postman');

if ($response->object !== null) {
if ($response->responseBodies !== null) {
// handle response
}
} catch (Throwable $e) {
Expand Down
Loading

0 comments on commit 9130d39

Please sign in to comment.