-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I was testing this project against my library and when trying to retrieve my libraries it's failing on unmarshal:
Code snippet:
s := plexgo.New(
plexgo.WithServerURL(cfg.ServerURL),
plexgo.WithSecurity(apiKey),
)
res, err := s.Library.GetAllLibraries(ctx)
if err != nil {
return fmt.Errorf("error getting libraries: %w", err)
}
Error
2025/04/18 10:00:20 ERROR error during execution error="error getting libraries: error unmarshalling json response body: invalid value for Hidden: 2"
I queried my libraries via curl, and I can confirm my library has a library directory with a hidden: 2 value:
...
{
"allowSync": true,
"art": "/:/resources/movie-fanart.jpg",
"composite": "/library/sections/10/composite/1744993592",
"filters": true,
"refreshing": false,
"thumb": "/:/resources/video.png",
"key": "10",
"type": "movie",
"title": "Youtube DL",
"agent": "com.plexapp.agents.none",
"scanner": "Plex Video Files Scanner",
"language": "xn",
"uuid": "490e7b0d-fa6f-408c-9f16-b1dbc247a322",
"updatedAt": 1744993645,
"createdAt": 1632720595,
"scannedAt": 1744993592,
"content": true,
"directory": true,
"contentChangedAt": 73395424,
"hidden": 2,
"Location": [
{
"id": 24,
"path": "/youtube_dl/video"
},
{
"id": 25,
"path": "/youtube_dl/subscriptions"
}
]
}
...
I'm not actually sure what the 2 represents though. It's not hidden at least not that I can tell. Unfortunately, it also a bit of a blocker for my project, given it's failing on listing the libraries. I can work around by manually manipulating the file in vendor for now.
That being said, it might be a good idea to not error in cases like this. Otherwise the SDK will fail when the API is updated and the SDK isn't, which is likely to be pretty common. It should just treat unknown values as if they didn't exist, or it should pass them through. I guess the sdk is generated though so im not sure if the generator would support this.