devvit icon indicating copy to clipboard operation
devvit copied to clipboard

Add `before` to GetPageRevisionsOptions

Open PitchforkAssistant opened this issue 4 months ago • 0 comments

This is the definition for the GetPageRevisionsOptions, which are the arguments to get a Listing of a wiki page's revisions.

https://github.com/reddit/devvit/blob/11c2d52af8134ca9f4379590077f9095f73477d6/packages/public-api/src/apis/reddit/models/WikiPage.ts#L37-L48

It mostly redefines the ListingFetchOptions type, but with the addition of the subredditName and page, minus the before and more properties.

It does appear that the revisions endpoint supports the before property, which would be pretty useful for only fetching revisions newer than a certain one. The corresponding protos function for getting the revisions also takes the before option.

The simplest fix would be to add a before field to the type and pass it into the Listing in getPageRevisions, but basing it on the ListingFetchOptions may be better (similar to say GetPostOptions):

export type GetPageRevisionsOptions = Omit<ListingFetchOptions, 'more'> & {
  /** The name of the subreddit the page is in. */
  subredditName: string;
  /** The name of the page to get revisions for. */
  page: string;
};

PitchforkAssistant avatar Aug 11 '25 23:08 PitchforkAssistant