Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sessions.getSessionHistory filter param does not work? #21

Open
BobWithHair opened this issue Aug 20, 2024 · 3 comments
Open

sessions.getSessionHistory filter param does not work? #21

BobWithHair opened this issue Aug 20, 2024 · 3 comments

Comments

@BobWithHair
Copy link

Running this code:

const response = await plexAPI.sessions.getSessionHistory(
  'viewedAt:desc',
  undefined,
  { viewedAt: '>=1723511329' }
);

Sends this url: http://<MY_PLEX_SERVER>/status/sessions/history/all?sort=viewedAt%3Adesc

So as you can see, the filter is completely omitted. The documentation doesn't say anything outside of:

image

The lib's source code defines the Filter type as an empty object:

image

The only thing helping to try and figure this out is inspecting the Network tab when going in Plex's history page:

image

@BobWithHair
Copy link
Author

Updated to 0.23.0 and this still does not seem to work. Am I doing it wrong or is it a bug?

@LukeHagar
Copy link
Owner

Hey @BobWithHair,

Can you confirm that the local package is up to date?
I can confirm the most recent regeneration contains the updated filter value:

export type GetSessionHistoryRequest = {
  /**
   * Sorts the results by the specified field followed by the direction (asc, desc)
   *
   * @remarks
   */
  sort?: string | undefined;
  /**
   * Filter results by those that are related to a specific users id
   *
   * @remarks
   */
  accountId?: number | undefined;
  /**
   * Filters content by field and direction/equality
   *
   * @remarks
   * (Unknown if viewedAt is the only supported column)
   */
  filter?: QueryParamFilter | undefined;
  /**
   * Filters the results based on the id of a valid library section
   *
   * @remarks
   */
  librarySectionID?: number | undefined;
};

@BobWithHair
Copy link
Author

Hey @LukeHagar! Sorry, haven't been working on my project in the last week or so. So, yes my package is up to date. Just re-updated it to the most recent 0.23.5

I did and still do see that GetSessionHistoryRequest type, but the QueryParamFilter type is only an empty object:

image.

But could you comment on the syntax I used for the filter in my original post? Because it is not so simple to figure out what syntax is expected to make the filter work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Open Issues
Development

No branches or pull requests

2 participants