From aeebf438e1b1782df8a5082fe0a04c5c8f4ad830 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Fri, 4 Oct 2024 00:10:38 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.406.0 --- .speakeasy/gen.lock | 8 +- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 10 +- RELEASES.md | 12 +- activities.go | 33 +-- authentication.go | 65 ++---- butler.go | 81 +++---- .../getlibraryitemsmediacontainer.md | 2 +- .../operations/gettokendetailsresponse.md | 12 +- .../gettokendetailsuserplexaccount.md | 4 +- .../operations/postuserssignindataresponse.md | 12 +- .../postuserssignindatauserplexaccount.md | 4 +- hubs.go | 49 ++-- library.go | 209 ++++++------------ log.go | 49 ++-- media.go | 81 +++---- models/operations/getlibraryitems.go | 4 +- models/operations/gettokendetails.go | 13 +- models/operations/postuserssignindata.go | 13 +- playlists.go | 145 ++++-------- plex.go | 113 +++------- plexapi.go | 4 +- search.go | 49 ++-- server.go | 145 ++++-------- sessions.go | 65 ++---- statistics.go | 49 ++-- updater.go | 49 ++-- video.go | 33 +-- watchlist.go | 17 +- 29 files changed, 432 insertions(+), 900 deletions(-) diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index b06abcf..5dc28cb 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: dfa99515-01c0-42eb-9be5-ee212fd03eb3 management: - docChecksum: 1ee2e5413af07e886e33659b9b269dd5 + docChecksum: 23094f3a9fe02710a8628ad5456f5d42 docVersion: 0.0.3 speakeasyVersion: 1.406.0 generationVersion: 2.429.0 - releaseVersion: 0.15.0 - configChecksum: a2c4d09241a2acac8ca19d8c9ee8f2bc + releaseVersion: 0.15.1 + configChecksum: 7fd96d28c0c2ba4db014d922c6a65cc6 repoURL: https://github.com/LukeHagar/plexgo.git repoSubDirectory: . installationURL: https://github.com/LukeHagar/plexgo @@ -2065,7 +2065,7 @@ examples: speakeasy-default-get-token-details: responses: "200": - application/json: {"adsConsent": true, "adsConsentReminderAt": "2019-08-24T14:15:22Z", "adsConsentSetAt": "2019-08-24T14:15:22Z", "anonymous": false, "authToken": "CxoUzBTSV5hsxjTpFKaf", "backupCodesCreated": false, "confirmed": false, "country": "US", "email": "username@email.com", "emailOnlyAuth": false, "experimentalFeatures": false, "friendlyName": "friendlyUsername", "entitlements": ["[]"], "guest": false, "hasPassword": true, "home": false, "homeAdmin": false, "homeSize": 1, "id": 13692262, "joinedAt": 1556281940, "locale": null, "mailingListActive": false, "mailingListStatus": "active", "maxHomeSize": 15, "pin": "string", "profile": {"autoSelectAudio": true, "defaultAudioLanguage": "ja", "defaultSubtitleLanguage": "en", "autoSelectSubtitle": 1, "defaultSubtitleAccessibility": 1, "defaultSubtitleForced": 1, "watchedIndicator": 1, "mediaReviewsVisibility": 1}, "protected": false, "rememberExpiresAt": 1556281940, "restricted": false, "roles": ["string"], "scrobbleTypes": "", "services": [{"identifier": "metadata-dev", "endpoint": "https://epg.provider.plex.tv", "token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", "secret": "string", "status": "online"}], "subscription": {"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}, "subscriptionDescription": "string", "subscriptions": [{"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}], "thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", "title": "UsernameTitle", "twoFactorEnabled": false, "username": "Username", "uuid": "dae343c1f45beb4f", "attributionPartner": null} + application/json: {"adsConsent": true, "adsConsentReminderAt": 1556281940, "adsConsentSetAt": 1556281940, "anonymous": false, "authToken": "CxoUzBTSV5hsxjTpFKaf", "backupCodesCreated": false, "confirmed": false, "country": "US", "email": "username@email.com", "emailOnlyAuth": false, "experimentalFeatures": false, "friendlyName": "friendlyUsername", "entitlements": ["[]"], "guest": false, "hasPassword": true, "home": false, "homeAdmin": false, "homeSize": 1, "id": 13692262, "joinedAt": 1556281940, "locale": null, "mailingListActive": false, "mailingListStatus": "active", "maxHomeSize": 15, "pin": "string", "profile": {"autoSelectAudio": true, "defaultAudioLanguage": "ja", "defaultSubtitleLanguage": "en", "autoSelectSubtitle": 1, "defaultSubtitleAccessibility": 1, "defaultSubtitleForced": 1, "watchedIndicator": 1, "mediaReviewsVisibility": 1}, "protected": false, "rememberExpiresAt": 1556281940, "restricted": false, "roles": ["string"], "scrobbleTypes": "", "services": [{"identifier": "metadata-dev", "endpoint": "https://epg.provider.plex.tv", "token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", "secret": "string", "status": "online"}], "subscription": {"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}, "subscriptionDescription": "string", "subscriptions": [{"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}], "thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", "title": "UsernameTitle", "twoFactorEnabled": false, "username": "Username", "uuid": "dae343c1f45beb4f", "attributionPartner": null} "400": application/json: {"errors": []} "401": diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 096d75e..27f3f58 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true go: - version: 0.15.0 + version: 0.15.1 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 6a7d056..e0a31d1 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -9,8 +9,8 @@ sources: - main plexapi: sourceNamespace: plexapi - sourceRevisionDigest: sha256:c6ab8f13847c7cdc4ab3752f517164d7da08266726255aa0d614b1eaea66fb0e - sourceBlobDigest: sha256:64c7694915a0828aeb256d10d2fa0ea477681785b818916b6681be8cc5ffb93b + sourceRevisionDigest: sha256:8d2eb3adbd97ce5976291c4b123d1eadfef62d1f6bf86c6a18bcd89443f2f390 + sourceBlobDigest: sha256:3e48471b7e058840fc598ccd75b2cbf8187961c7e625fe7b606555ce9a9bf109 tags: - latest - main @@ -18,10 +18,10 @@ targets: plexgo: source: plexapi sourceNamespace: plexapi - sourceRevisionDigest: sha256:c6ab8f13847c7cdc4ab3752f517164d7da08266726255aa0d614b1eaea66fb0e - sourceBlobDigest: sha256:64c7694915a0828aeb256d10d2fa0ea477681785b818916b6681be8cc5ffb93b + sourceRevisionDigest: sha256:8d2eb3adbd97ce5976291c4b123d1eadfef62d1f6bf86c6a18bcd89443f2f390 + sourceBlobDigest: sha256:3e48471b7e058840fc598ccd75b2cbf8187961c7e625fe7b606555ce9a9bf109 codeSamplesNamespace: code-samples-go-plexgo - codeSamplesRevisionDigest: sha256:9ae03dbe12a6438ac7667de48bf864bbeb4b470bd87b38555484879a998889ba + codeSamplesRevisionDigest: sha256:321c24585c4a0c1ed0e924fe504aa2f02e26d9e6d539262e90861142fbf72882 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/RELEASES.md b/RELEASES.md index c3cde6c..536580d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -942,4 +942,14 @@ Based on: ### Generated - [go v0.15.0] . ### Releases -- [Go v0.15.0] https://github.com/LukeHagar/plexgo/releases/tag/v0.15.0 - . \ No newline at end of file +- [Go v0.15.0] https://github.com/LukeHagar/plexgo/releases/tag/v0.15.0 - . + +## 2024-10-04 00:09:04 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.406.0 (2.429.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.15.1] . +### Releases +- [Go v0.15.1] https://github.com/LukeHagar/plexgo/releases/tag/v0.15.1 - . \ No newline at end of file diff --git a/activities.go b/activities.go index cf8d2ae..97a9dce 100644 --- a/activities.go +++ b/activities.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -89,16 +88,6 @@ func (s *Activities) GetServerActivities(ctx context.Context, opts ...operations if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -107,7 +96,11 @@ func (s *Activities) GetServerActivities(ctx context.Context, opts ...operations httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -341,16 +334,6 @@ func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID st if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -359,7 +342,11 @@ func (s *Activities) CancelServerActivities(ctx context.Context, activityUUID st httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/authentication.go b/authentication.go index e48aec9..612d207 100644 --- a/authentication.go +++ b/authentication.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -92,16 +91,6 @@ func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -110,7 +99,11 @@ func (s *Authentication) GetTransientToken(ctx context.Context, type_ operations httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -328,16 +321,6 @@ func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, sou if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -346,7 +329,11 @@ func (s *Authentication) GetSourceConnectionInformation(ctx context.Context, sou httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -560,16 +547,6 @@ func (s *Authentication) GetTokenDetails(ctx context.Context, opts ...operations if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -578,7 +555,11 @@ func (s *Authentication) GetTokenDetails(ctx context.Context, opts ...operations httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -825,16 +806,6 @@ func (s *Authentication) PostUsersSignInData(ctx context.Context, request operat if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -843,7 +814,11 @@ func (s *Authentication) PostUsersSignInData(ctx context.Context, request operat httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/butler.go b/butler.go index 1270dd3..b844ecd 100644 --- a/butler.go +++ b/butler.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -83,16 +82,6 @@ func (s *Butler) GetButlerTasks(ctx context.Context, opts ...operations.Option) if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -101,7 +90,11 @@ func (s *Butler) GetButlerTasks(ctx context.Context, opts ...operations.Option) httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -335,16 +328,6 @@ func (s *Butler) StartAllTasks(ctx context.Context, opts ...operations.Option) ( if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -353,7 +336,11 @@ func (s *Butler) StartAllTasks(ctx context.Context, opts ...operations.Option) ( httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -562,16 +549,6 @@ func (s *Butler) StopAllTasks(ctx context.Context, opts ...operations.Option) (* if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -580,7 +557,11 @@ func (s *Butler) StopAllTasks(ctx context.Context, opts ...operations.Option) (* httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -797,16 +778,6 @@ func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName, op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -815,7 +786,11 @@ func (s *Butler) StartTask(ctx context.Context, taskName operations.TaskName, op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1030,16 +1005,6 @@ func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTask if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1048,7 +1013,11 @@ func (s *Butler) StopTask(ctx context.Context, taskName operations.PathParamTask httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/docs/models/operations/getlibraryitemsmediacontainer.md b/docs/models/operations/getlibraryitemsmediacontainer.md index 371a3a3..b4da90a 100644 --- a/docs/models/operations/getlibraryitemsmediacontainer.md +++ b/docs/models/operations/getlibraryitemsmediacontainer.md @@ -29,5 +29,5 @@ The Meta object is only included in the response if the `includeMeta` parameter | `ViewGroup` | *string* | :heavy_check_mark: | N/A | movie | | `ViewMode` | **int* | :heavy_minus_sign: | N/A | 65592 | | `MixedParents` | **bool* | :heavy_minus_sign: | N/A | true | -| `Metadata` | [][operations.GetLibraryItemsMetadata](../../models/operations/getlibraryitemsmetadata.md) | :heavy_check_mark: | N/A | | +| `Metadata` | [][operations.GetLibraryItemsMetadata](../../models/operations/getlibraryitemsmetadata.md) | :heavy_minus_sign: | N/A | | | `Meta` | [*operations.GetLibraryItemsMeta](../../models/operations/getlibraryitemsmeta.md) | :heavy_minus_sign: | The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.
| | \ No newline at end of file diff --git a/docs/models/operations/gettokendetailsresponse.md b/docs/models/operations/gettokendetailsresponse.md index dcb6ad5..8f92b6d 100644 --- a/docs/models/operations/gettokendetailsresponse.md +++ b/docs/models/operations/gettokendetailsresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | -| `UserPlexAccount` | [*operations.GetTokenDetailsUserPlexAccount](../../models/operations/gettokendetailsuserplexaccount.md) | :heavy_minus_sign: | Logged in user details | {
"adsConsent": true,
"adsConsentReminderAt": "2019-08-24T14:15:22Z",
"adsConsentSetAt": "2019-08-24T14:15:22Z",
"anonymous": false,
"authToken": "CxoUzBTSV5hsxjTpFKaf",
"backupCodesCreated": false,
"confirmed": false,
"country": "US",
"email": "username@email.com",
"emailOnlyAuth": false,
"experimentalFeatures": false,
"friendlyName": "friendlyUsername",
"entitlements": [],
"guest": false,
"hasPassword": true,
"home": false,
"homeAdmin": false,
"homeSize": 1,
"id": 13692262,
"joinedAt": 1721154902,
"locale": null,
"mailingListActive": false,
"mailingListStatus": "subscribed",
"maxHomeSize": 15,
"pastSubscriptions": [
{
"id": "string",
"mode": "string",
"renewsAt": "string",
"endsAt": "1556281940",
"canceled": "0",
"gracePeriod": "0",
"onHold": "0",
"canReactivate": "0",
"canUpgrade": "0",
"canDowngrade": "0",
"canConvert": "0",
"type": "plexpass",
"transfer": "string",
"state": "ended",
"billing": [
{
"internalPaymentMethod": "string",
"paymentMethodId": "string"
}
]
}
],
"pin": "string",
"profile": [
{
"autoSelectAudio": true,
"defaultAudioLanguage": "ja",
"defaultSubtitleLanguage": "en",
"autoSelectSubtitle": 1,
"defaultSubtitleAccessibility": 1,
"defaultSubtitleForced": 0,
"watchedIndicator": 1,
"mediaReviewsVisibility": 0
}
],
"protected": false,
"rememberExpiresAt": 1722364046,
"restricted": false,
"roles": [
"string"
],
"scrobbleTypes": "",
"services": [
{
"identifier": "metadata-dev",
"endpoint": "https://epg.provider.plex.tv",
"token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv",
"secret": "string",
"status": "online"
}
],
"subscription": {
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
},
"subscriptionDescription": "string",
"subscriptions": [
{
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
}
],
"thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101",
"title": "UsernameTitle",
"trials": [
{}
],
"twoFactorEnabled": false,
"username": "Username",
"uuid": "dae343c1f45beb4f"
} | \ No newline at end of file +| 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 | +| `UserPlexAccount` | [*operations.GetTokenDetailsUserPlexAccount](../../models/operations/gettokendetailsuserplexaccount.md) | :heavy_minus_sign: | Logged in user details | \ No newline at end of file diff --git a/docs/models/operations/gettokendetailsuserplexaccount.md b/docs/models/operations/gettokendetailsuserplexaccount.md index 4cb5c08..4569bcf 100644 --- a/docs/models/operations/gettokendetailsuserplexaccount.md +++ b/docs/models/operations/gettokendetailsuserplexaccount.md @@ -8,8 +8,8 @@ Logged in user details | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AdsConsent` | *bool* | :heavy_check_mark: | Unknown | | -| `AdsConsentReminderAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Unknown | | -| `AdsConsentSetAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Unknown | | +| `AdsConsentReminderAt` | *int64* | :heavy_check_mark: | N/A | 1556281940 | +| `AdsConsentSetAt` | *int64* | :heavy_check_mark: | N/A | 1556281940 | | `Anonymous` | **bool* | :heavy_minus_sign: | Unknown | | | `AuthToken` | *string* | :heavy_check_mark: | The account token | CxoUzBTSV5hsxjTpFKaf | | `BackupCodesCreated` | **bool* | :heavy_minus_sign: | If the two-factor authentication backup codes have been created | | diff --git a/docs/models/operations/postuserssignindataresponse.md b/docs/models/operations/postuserssignindataresponse.md index 4d60e7a..13460f0 100644 --- a/docs/models/operations/postuserssignindataresponse.md +++ b/docs/models/operations/postuserssignindataresponse.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ContentType` | *string* | :heavy_check_mark: | HTTP response content type for this operation | | -| `StatusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | | -| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | | -| `UserPlexAccount` | [*operations.PostUsersSignInDataUserPlexAccount](../../models/operations/postuserssignindatauserplexaccount.md) | :heavy_minus_sign: | Returns the user account data with a valid auth token | {
"adsConsent": true,
"adsConsentReminderAt": "2019-08-24T14:15:22Z",
"adsConsentSetAt": "2019-08-24T14:15:22Z",
"anonymous": false,
"authToken": "CxoUzBTSV5hsxjTpFKaf",
"backupCodesCreated": false,
"confirmed": false,
"country": "US",
"email": "username@email.com",
"emailOnlyAuth": false,
"experimentalFeatures": false,
"friendlyName": "friendlyUsername",
"entitlements": [],
"guest": false,
"hasPassword": true,
"home": false,
"homeAdmin": false,
"homeSize": 1,
"id": 13692262,
"joinedAt": 1721154902,
"locale": null,
"mailingListActive": false,
"mailingListStatus": "subscribed",
"maxHomeSize": 15,
"pastSubscriptions": [
{
"id": "string",
"mode": "string",
"renewsAt": "string",
"endsAt": "1556281940",
"canceled": "0",
"gracePeriod": "0",
"onHold": "0",
"canReactivate": "0",
"canUpgrade": "0",
"canDowngrade": "0",
"canConvert": "0",
"type": "plexpass",
"transfer": "string",
"state": "ended",
"billing": [
{
"internalPaymentMethod": "string",
"paymentMethodId": "string"
}
]
}
],
"pin": "string",
"profile": [
{
"autoSelectAudio": true,
"defaultAudioLanguage": "ja",
"defaultSubtitleLanguage": "en",
"autoSelectSubtitle": 1,
"defaultSubtitleAccessibility": 1,
"defaultSubtitleForced": 0,
"watchedIndicator": 1,
"mediaReviewsVisibility": 0
}
],
"protected": false,
"rememberExpiresAt": 1722364046,
"restricted": false,
"roles": [
"string"
],
"scrobbleTypes": "",
"services": [
{
"identifier": "metadata-dev",
"endpoint": "https://epg.provider.plex.tv",
"token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv",
"secret": "string",
"status": "online"
}
],
"subscription": {
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
},
"subscriptionDescription": "string",
"subscriptions": [
{
"features": [
"Android - Dolby Vision"
],
"active": true,
"subscribedAt": "2021-04-12T18:21:12Z",
"status": "Inactive",
"paymentService": "string",
"plan": "string"
}
],
"thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101",
"title": "UsernameTitle",
"trials": [
{}
],
"twoFactorEnabled": false,
"username": "Username",
"uuid": "dae343c1f45beb4f"
} | \ No newline at end of file +| 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 | +| `UserPlexAccount` | [*operations.PostUsersSignInDataUserPlexAccount](../../models/operations/postuserssignindatauserplexaccount.md) | :heavy_minus_sign: | Returns the user account data with a valid auth token | \ No newline at end of file diff --git a/docs/models/operations/postuserssignindatauserplexaccount.md b/docs/models/operations/postuserssignindatauserplexaccount.md index d93fe55..a233244 100644 --- a/docs/models/operations/postuserssignindatauserplexaccount.md +++ b/docs/models/operations/postuserssignindatauserplexaccount.md @@ -8,8 +8,8 @@ Returns the user account data with a valid auth token | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `AdsConsent` | *bool* | :heavy_check_mark: | Unknown | | -| `AdsConsentReminderAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Unknown | | -| `AdsConsentSetAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | Unknown | | +| `AdsConsentReminderAt` | *int64* | :heavy_check_mark: | N/A | 1556281940 | +| `AdsConsentSetAt` | *int64* | :heavy_check_mark: | N/A | 1556281940 | | `Anonymous` | **bool* | :heavy_minus_sign: | Unknown | | | `AuthToken` | *string* | :heavy_check_mark: | The account token | CxoUzBTSV5hsxjTpFKaf | | `BackupCodesCreated` | **bool* | :heavy_minus_sign: | If the two-factor authentication backup codes have been created | | diff --git a/hubs.go b/hubs.go index 64770af..1a2f74b 100644 --- a/hubs.go +++ b/hubs.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -92,16 +91,6 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -110,7 +99,11 @@ func (s *Hubs) GetGlobalHubs(ctx context.Context, count *float64, onlyTransient httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -344,16 +337,6 @@ func (s *Hubs) GetRecentlyAdded(ctx context.Context, request operations.GetRecen if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -362,7 +345,11 @@ func (s *Hubs) GetRecentlyAdded(ctx context.Context, request operations.GetRecen httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -560,16 +547,6 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *flo if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -578,7 +555,11 @@ func (s *Hubs) GetLibraryHubs(ctx context.Context, sectionID float64, count *flo httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/library.go b/library.go index d26c056..eb02fa3 100644 --- a/library.go +++ b/library.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -92,16 +91,6 @@ func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64, if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -110,7 +99,11 @@ func (s *Library) GetFileHash(ctx context.Context, url_ string, type_ *float64, httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -323,16 +316,6 @@ func (s *Library) GetRecentlyAddedLibrary(ctx context.Context, request operation if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -341,7 +324,11 @@ func (s *Library) GetRecentlyAddedLibrary(ctx context.Context, request operation httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -576,16 +563,6 @@ func (s *Library) GetAllLibraries(ctx context.Context, opts ...operations.Option if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -594,7 +571,11 @@ func (s *Library) GetAllLibraries(ctx context.Context, opts ...operations.Option httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -871,16 +852,6 @@ func (s *Library) GetLibraryDetails(ctx context.Context, sectionKey int, include if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -889,7 +860,11 @@ func (s *Library) GetLibraryDetails(ctx context.Context, sectionKey int, include httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1123,16 +1098,6 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionKey int, opts ...ope if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1141,7 +1106,11 @@ func (s *Library) DeleteLibrary(ctx context.Context, sectionKey int, opts ...ope httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1373,16 +1342,6 @@ func (s *Library) GetLibraryItems(ctx context.Context, request operations.GetLib if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1391,7 +1350,11 @@ func (s *Library) GetLibraryItems(ctx context.Context, request operations.GetLib httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1630,16 +1593,6 @@ func (s *Library) GetRefreshLibraryMetadata(ctx context.Context, sectionKey int, if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1648,7 +1601,11 @@ func (s *Library) GetRefreshLibraryMetadata(ctx context.Context, sectionKey int, httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1883,16 +1840,6 @@ func (s *Library) GetSearchLibrary(ctx context.Context, sectionKey int, type_ op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1901,7 +1848,11 @@ func (s *Library) GetSearchLibrary(ctx context.Context, sectionKey int, type_ op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -2141,16 +2092,6 @@ func (s *Library) GetSearchAllLibraries(ctx context.Context, request operations. if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -2159,7 +2100,11 @@ func (s *Library) GetSearchAllLibraries(ctx context.Context, request operations. httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -2393,16 +2338,6 @@ func (s *Library) GetMetaDataByRatingKey(ctx context.Context, ratingKey int64, o if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -2411,7 +2346,11 @@ func (s *Library) GetMetaDataByRatingKey(ctx context.Context, ratingKey int64, o httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -2650,16 +2589,6 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -2668,7 +2597,11 @@ func (s *Library) GetMetadataChildren(ctx context.Context, ratingKey float64, in httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -2907,16 +2840,6 @@ func (s *Library) GetTopWatchedContent(ctx context.Context, type_ operations.Get if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -2925,7 +2848,11 @@ func (s *Library) GetTopWatchedContent(ctx context.Context, type_ operations.Get httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -3155,16 +3082,6 @@ func (s *Library) GetOnDeck(ctx context.Context, opts ...operations.Option) (*op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -3173,7 +3090,11 @@ func (s *Library) GetOnDeck(ctx context.Context, opts ...operations.Option) (*op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/log.go b/log.go index 9447999..e293c10 100644 --- a/log.go +++ b/log.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -93,16 +92,6 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -111,7 +100,11 @@ func (s *Log) LogLine(ctx context.Context, level operations.Level, message strin httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -346,16 +339,6 @@ func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operatio if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -364,7 +347,11 @@ func (s *Log) LogMultiLine(ctx context.Context, request string, opts ...operatio httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -573,16 +560,6 @@ func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) ( if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -591,7 +568,11 @@ func (s *Log) EnablePaperTrail(ctx context.Context, opts ...operations.Option) ( httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/media.go b/media.go index 09b1ec6..4354613 100644 --- a/media.go +++ b/media.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -91,16 +90,6 @@ func (s *Media) MarkPlayed(ctx context.Context, key float64, opts ...operations. if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -109,7 +98,11 @@ func (s *Media) MarkPlayed(ctx context.Context, key float64, opts ...operations. httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -326,16 +319,6 @@ func (s *Media) MarkUnplayed(ctx context.Context, key float64, opts ...operation if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -344,7 +327,11 @@ func (s *Media) MarkUnplayed(ctx context.Context, key float64, opts ...operation httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -563,16 +550,6 @@ func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64 if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -581,7 +558,11 @@ func (s *Media) UpdatePlayProgress(ctx context.Context, key string, time float64 httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -796,16 +777,6 @@ func (s *Media) GetBannerImage(ctx context.Context, request operations.GetBanner if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -814,7 +785,11 @@ func (s *Media) GetBannerImage(ctx context.Context, request operations.GetBanner httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1044,16 +1019,6 @@ func (s *Media) GetThumbImage(ctx context.Context, request operations.GetThumbIm if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1062,7 +1027,11 @@ func (s *Media) GetThumbImage(ctx context.Context, request operations.GetThumbIm httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/models/operations/getlibraryitems.go b/models/operations/getlibraryitems.go index 13aba30..5e88725 100644 --- a/models/operations/getlibraryitems.go +++ b/models/operations/getlibraryitems.go @@ -2596,7 +2596,7 @@ type GetLibraryItemsMediaContainer struct { ViewGroup string `json:"viewGroup"` ViewMode *int `json:"viewMode,omitempty"` MixedParents *bool `json:"mixedParents,omitempty"` - Metadata []GetLibraryItemsMetadata `json:"Metadata"` + Metadata []GetLibraryItemsMetadata `json:"Metadata,omitempty"` // The Meta object is only included in the response if the `includeMeta` parameter is set to `1`. // Meta *GetLibraryItemsMeta `json:"Meta,omitempty"` @@ -2751,7 +2751,7 @@ func (o *GetLibraryItemsMediaContainer) GetMixedParents() *bool { func (o *GetLibraryItemsMediaContainer) GetMetadata() []GetLibraryItemsMetadata { if o == nil { - return []GetLibraryItemsMetadata{} + return nil } return o.Metadata } diff --git a/models/operations/gettokendetails.go b/models/operations/gettokendetails.go index 6760d81..4d90691 100644 --- a/models/operations/gettokendetails.go +++ b/models/operations/gettokendetails.go @@ -7,7 +7,6 @@ import ( "fmt" "github.com/LukeHagar/plexgo/internal/utils" "net/http" - "time" ) var GetTokenDetailsServerList = []string{ @@ -498,11 +497,9 @@ func (o *GetTokenDetailsSubscription) GetPlan() *string { // GetTokenDetailsUserPlexAccount - Logged in user details type GetTokenDetailsUserPlexAccount struct { // Unknown - AdsConsent *bool `json:"adsConsent"` - // Unknown - AdsConsentReminderAt *time.Time `json:"adsConsentReminderAt"` - // Unknown - AdsConsentSetAt *time.Time `json:"adsConsentSetAt"` + AdsConsent *bool `json:"adsConsent"` + AdsConsentReminderAt *int64 `json:"adsConsentReminderAt"` + AdsConsentSetAt *int64 `json:"adsConsentSetAt"` // Unknown Anonymous *bool `default:"false" json:"anonymous"` // The account token @@ -597,14 +594,14 @@ func (o *GetTokenDetailsUserPlexAccount) GetAdsConsent() *bool { return o.AdsConsent } -func (o *GetTokenDetailsUserPlexAccount) GetAdsConsentReminderAt() *time.Time { +func (o *GetTokenDetailsUserPlexAccount) GetAdsConsentReminderAt() *int64 { if o == nil { return nil } return o.AdsConsentReminderAt } -func (o *GetTokenDetailsUserPlexAccount) GetAdsConsentSetAt() *time.Time { +func (o *GetTokenDetailsUserPlexAccount) GetAdsConsentSetAt() *int64 { if o == nil { return nil } diff --git a/models/operations/postuserssignindata.go b/models/operations/postuserssignindata.go index a69172f..34d7864 100644 --- a/models/operations/postuserssignindata.go +++ b/models/operations/postuserssignindata.go @@ -7,7 +7,6 @@ import ( "fmt" "github.com/LukeHagar/plexgo/internal/utils" "net/http" - "time" ) var PostUsersSignInDataServerList = []string{ @@ -832,11 +831,9 @@ type Trials struct { // PostUsersSignInDataUserPlexAccount - Returns the user account data with a valid auth token type PostUsersSignInDataUserPlexAccount struct { // Unknown - AdsConsent *bool `json:"adsConsent"` - // Unknown - AdsConsentReminderAt *time.Time `json:"adsConsentReminderAt"` - // Unknown - AdsConsentSetAt *time.Time `json:"adsConsentSetAt"` + AdsConsent *bool `json:"adsConsent"` + AdsConsentReminderAt *int64 `json:"adsConsentReminderAt"` + AdsConsentSetAt *int64 `json:"adsConsentSetAt"` // Unknown Anonymous *bool `default:"false" json:"anonymous"` // The account token @@ -933,14 +930,14 @@ func (o *PostUsersSignInDataUserPlexAccount) GetAdsConsent() *bool { return o.AdsConsent } -func (o *PostUsersSignInDataUserPlexAccount) GetAdsConsentReminderAt() *time.Time { +func (o *PostUsersSignInDataUserPlexAccount) GetAdsConsentReminderAt() *int64 { if o == nil { return nil } return o.AdsConsentReminderAt } -func (o *PostUsersSignInDataUserPlexAccount) GetAdsConsentSetAt() *time.Time { +func (o *PostUsersSignInDataUserPlexAccount) GetAdsConsentSetAt() *int64 { if o == nil { return nil } diff --git a/playlists.go b/playlists.go index 59242a5..d6789be 100644 --- a/playlists.go +++ b/playlists.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -92,16 +91,6 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -110,7 +99,11 @@ func (s *Playlists) CreatePlaylist(ctx context.Context, request operations.Creat httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -349,16 +342,6 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -367,7 +350,11 @@ func (s *Playlists) GetPlaylists(ctx context.Context, playlistType *operations.P httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -602,16 +589,6 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64, opts .. if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -620,7 +597,11 @@ func (s *Playlists) GetPlaylist(ctx context.Context, playlistID float64, opts .. httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -854,16 +835,6 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64, opts if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -872,7 +843,11 @@ func (s *Playlists) DeletePlaylist(ctx context.Context, playlistID float64, opts httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1091,16 +1066,6 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, titl if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1109,7 +1074,11 @@ func (s *Playlists) UpdatePlaylist(ctx context.Context, playlistID float64, titl httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1330,16 +1299,6 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1348,7 +1307,11 @@ func (s *Playlists) GetPlaylistContents(ctx context.Context, playlistID float64, httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1582,16 +1545,6 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float6 if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1600,7 +1553,11 @@ func (s *Playlists) ClearPlaylistContents(ctx context.Context, playlistID float6 httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1820,16 +1777,6 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1838,7 +1785,11 @@ func (s *Playlists) AddPlaylistContents(ctx context.Context, playlistID float64, httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -2078,16 +2029,6 @@ func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force opera if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -2096,7 +2037,11 @@ func (s *Playlists) UploadPlaylist(ctx context.Context, path string, force opera httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/plex.go b/plex.go index 99713e5..dfd8651 100644 --- a/plex.go +++ b/plex.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -88,16 +87,6 @@ func (s *Plex) GetCompanionsData(ctx context.Context, opts ...operations.Option) if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -106,7 +95,11 @@ func (s *Plex) GetCompanionsData(ctx context.Context, opts ...operations.Option) httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -341,16 +334,6 @@ func (s *Plex) GetUserFriends(ctx context.Context, opts ...operations.Option) (* if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -359,7 +342,11 @@ func (s *Plex) GetUserFriends(ctx context.Context, opts ...operations.Option) (* httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -590,16 +577,6 @@ func (s *Plex) GetGeoData(ctx context.Context, opts ...operations.Option) (*oper if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -608,7 +585,11 @@ func (s *Plex) GetGeoData(ctx context.Context, opts ...operations.Option) (*oper httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -838,16 +819,6 @@ func (s *Plex) GetHomeData(ctx context.Context, opts ...operations.Option) (*ope if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -856,7 +827,11 @@ func (s *Plex) GetHomeData(ctx context.Context, opts ...operations.Option) (*ope httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1108,16 +1083,6 @@ func (s *Plex) GetServerResources(ctx context.Context, includeHTTPS *operations. if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1126,7 +1091,11 @@ func (s *Plex) GetServerResources(ctx context.Context, includeHTTPS *operations. httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1371,16 +1340,6 @@ func (s *Plex) GetPin(ctx context.Context, request operations.GetPinRequest, opt if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1389,7 +1348,11 @@ func (s *Plex) GetPin(ctx context.Context, request operations.GetPinRequest, opt httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1607,16 +1570,6 @@ func (s *Plex) GetTokenByPinID(ctx context.Context, request operations.GetTokenB if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1625,7 +1578,11 @@ func (s *Plex) GetTokenByPinID(ctx context.Context, request operations.GetTokenB httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/plexapi.go b/plexapi.go index dc3e256..0134197 100644 --- a/plexapi.go +++ b/plexapi.go @@ -335,9 +335,9 @@ func New(opts ...SDKOption) *PlexAPI { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "0.0.3", - SDKVersion: "0.15.0", + SDKVersion: "0.15.1", GenVersion: "2.429.0", - UserAgent: "speakeasy-sdk/go 0.15.0 2.429.0 0.0.3 github.com/LukeHagar/plexgo", + UserAgent: "speakeasy-sdk/go 0.15.1 2.429.0 0.0.3 github.com/LukeHagar/plexgo", Globals: globals.Globals{}, ServerDefaults: []map[string]string{ { diff --git a/search.go b/search.go index 4b606ff..3f033bf 100644 --- a/search.go +++ b/search.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -105,16 +104,6 @@ func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *flo if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -123,7 +112,11 @@ func (s *Search) PerformSearch(ctx context.Context, query string, sectionID *flo httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -345,16 +338,6 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -363,7 +346,11 @@ func (s *Search) PerformVoiceSearch(ctx context.Context, query string, sectionID httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -580,16 +567,6 @@ func (s *Search) GetSearchResults(ctx context.Context, query string, opts ...ope if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -598,7 +575,11 @@ func (s *Search) GetSearchResults(ctx context.Context, query string, opts ...ope httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/server.go b/server.go index 1939b08..9b6458a 100644 --- a/server.go +++ b/server.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -83,16 +82,6 @@ func (s *Server) GetServerCapabilities(ctx context.Context, opts ...operations.O if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -101,7 +90,11 @@ func (s *Server) GetServerCapabilities(ctx context.Context, opts ...operations.O httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -331,16 +324,6 @@ func (s *Server) GetServerPreferences(ctx context.Context, opts ...operations.Op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -349,7 +332,11 @@ func (s *Server) GetServerPreferences(ctx context.Context, opts ...operations.Op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -579,16 +566,6 @@ func (s *Server) GetAvailableClients(ctx context.Context, opts ...operations.Opt if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -597,7 +574,11 @@ func (s *Server) GetAvailableClients(ctx context.Context, opts ...operations.Opt httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -827,16 +808,6 @@ func (s *Server) GetDevices(ctx context.Context, opts ...operations.Option) (*op if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -845,7 +816,11 @@ func (s *Server) GetDevices(ctx context.Context, opts ...operations.Option) (*op httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1071,16 +1046,6 @@ func (s *Server) GetServerIdentity(ctx context.Context, opts ...operations.Optio if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1089,7 +1054,11 @@ func (s *Server) GetServerIdentity(ctx context.Context, opts ...operations.Optio httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1296,16 +1265,6 @@ func (s *Server) GetMyPlexAccount(ctx context.Context, opts ...operations.Option if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1314,7 +1273,11 @@ func (s *Server) GetMyPlexAccount(ctx context.Context, opts ...operations.Option httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1548,16 +1511,6 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1566,7 +1519,11 @@ func (s *Server) GetResizedPhoto(ctx context.Context, request operations.GetResi httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -1781,16 +1738,6 @@ func (s *Server) GetMediaProviders(ctx context.Context, xPlexToken string, opts if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -1799,7 +1746,11 @@ func (s *Server) GetMediaProviders(ctx context.Context, xPlexToken string, opts httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -2029,16 +1980,6 @@ func (s *Server) GetServerList(ctx context.Context, opts ...operations.Option) ( if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -2047,7 +1988,11 @@ func (s *Server) GetServerList(ctx context.Context, opts ...operations.Option) ( httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/sessions.go b/sessions.go index 562767f..fbdf664 100644 --- a/sessions.go +++ b/sessions.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -83,16 +82,6 @@ func (s *Sessions) GetSessions(ctx context.Context, opts ...operations.Option) ( if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -101,7 +90,11 @@ func (s *Sessions) GetSessions(ctx context.Context, opts ...operations.Option) ( httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -342,16 +335,6 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -360,7 +343,11 @@ func (s *Sessions) GetSessionHistory(ctx context.Context, sort *string, accountI httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -590,16 +577,6 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context, opts ...operations. if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -608,7 +585,11 @@ func (s *Sessions) GetTranscodeSessions(ctx context.Context, opts ...operations. httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -842,16 +823,6 @@ func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string, if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -860,7 +831,11 @@ func (s *Sessions) StopTranscodeSession(ctx context.Context, sessionKey string, httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/statistics.go b/statistics.go index 1e8ed0f..5517a4b 100644 --- a/statistics.go +++ b/statistics.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -91,16 +90,6 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64, opts .. if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -109,7 +98,11 @@ func (s *Statistics) GetStatistics(ctx context.Context, timespan *int64, opts .. httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -347,16 +340,6 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -365,7 +348,11 @@ func (s *Statistics) GetResourcesStatistics(ctx context.Context, timespan *int64 httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -603,16 +590,6 @@ func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64 if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -621,7 +598,11 @@ func (s *Statistics) GetBandwidthStatistics(ctx context.Context, timespan *int64 httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/updater.go b/updater.go index 47a9b7c..81899a2 100644 --- a/updater.go +++ b/updater.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -84,16 +83,6 @@ func (s *Updater) GetUpdateStatus(ctx context.Context, opts ...operations.Option if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -102,7 +91,11 @@ func (s *Updater) GetUpdateStatus(ctx context.Context, opts ...operations.Option httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -340,16 +333,6 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -358,7 +341,11 @@ func (s *Updater) CheckForUpdates(ctx context.Context, download *operations.Down httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -576,16 +563,6 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -594,7 +571,11 @@ func (s *Updater) ApplyUpdates(ctx context.Context, tonight *operations.Tonight, httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/video.go b/video.go index b0daf0e..3125844 100644 --- a/video.go +++ b/video.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -87,16 +86,6 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -105,7 +94,11 @@ func (s *Video) GetTimeline(ctx context.Context, request operations.GetTimelineR httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { @@ -318,16 +311,6 @@ func (s *Video) StartUniversalTranscode(ctx context.Context, request operations. if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -336,7 +319,11 @@ func (s *Video) StartUniversalTranscode(ctx context.Context, request operations. httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil { diff --git a/watchlist.go b/watchlist.go index 5104a26..ee21c02 100644 --- a/watchlist.go +++ b/watchlist.go @@ -10,7 +10,6 @@ import ( "github.com/LukeHagar/plexgo/internal/utils" "github.com/LukeHagar/plexgo/models/operations" "github.com/LukeHagar/plexgo/models/sdkerrors" - "github.com/LukeHagar/plexgo/retry" "github.com/cenkalti/backoff/v4" "io" "net/http" @@ -93,16 +92,6 @@ func (s *Watchlist) GetWatchList(ctx context.Context, request operations.GetWatc if retryConfig == nil { if globalRetryConfig != nil { retryConfig = globalRetryConfig - } else { - retryConfig = &retry.Config{ - Strategy: "backoff", Backoff: &retry.BackoffStrategy{ - InitialInterval: 500, - MaxInterval: 60000, - Exponent: 1.5, - MaxElapsedTime: 3600000, - }, - RetryConnectionErrors: true, - } } } @@ -111,7 +100,11 @@ func (s *Watchlist) GetWatchList(ctx context.Context, request operations.GetWatc httpRes, err = utils.Retry(ctx, utils.Retries{ Config: retryConfig, StatusCodes: []string{ - "5XX", + "429", + "500", + "502", + "503", + "504", }, }, func() (*http.Response, error) { if req.Body != nil {