hongminhee,
@hongminhee@todon.eu avatar

The max_id, since_id, and min_id parameters in 's Timeline API assume that the post ID is a sortable number. (Is this correct?) , the implementation I'm building, uses UUIDs for post IDs internally, so I'm stuck on how to implement a Mastodon-compatible API.

https://docs.joinmastodon.org/methods/timelines/

julian,
@julian@fietkau.social avatar

@hongminhee Does it assume that? I don't see it clearly stated in the documentation that the IDs themselves need to be numerically sortable, just that, when given a specific ID, the server needs to be able to retrieve newer or older posts based on it.

Of course sortable snowflake IDs make implementing this easier on the server side.

hongminhee,
@hongminhee@todon.eu avatar

@julian According to @thisismissem, Mastodon uses Snowflake for ID generation.

thisismissem,
@thisismissem@hachyderm.io avatar

@hongminhee @julian correct, those parameters just say "newer / older than this ID", so you totally could fetch the object from the database and using like created at timestamps, but time-ordered unique IDs simplifies that for feeds & pagination by ID/cursor

thisismissem,
@thisismissem@hachyderm.io avatar

@hongminhee @julian keep in mind, you can totally not implement those parameters though, as it's all based on the next/prev Link headers, not URL construction necessarily

The only case is if clients for some reason try to make requests explicitly by constructing URLs instead of relying on headers

hongminhee,
@hongminhee@todon.eu avatar

@thisismissem Oh, I hadn't noticed that Mastodon's Timeline API comes with a Link header. Thanks for pointing that out!

thisismissem,
@thisismissem@hachyderm.io avatar

@hongminhee yup, if memory serves, that's how @dansup side-stepped this in Pixelfed

dansup,
@dansup@mastodon.social avatar
thisismissem,
@thisismissem@hachyderm.io avatar

@hongminhee yeah, Mastodon uses time-ordered ID values, by using Twitter's Snowflake algorithm.

You could always have your backend lookup the post with the given ID & grab the created_at timestamp or whatever that is used for pagination of statuses

hongminhee,
@hongminhee@todon.eu avatar

@thisismissem Okay, I guess I'll need to try UUIDv7 then!

thisismissem,
@thisismissem@hachyderm.io avatar

@hongminhee I'm using UUIDv7 in my FIRES project, so I'll be interested to see how you'll get on

hongminhee,
@hongminhee@todon.eu avatar

Is it time for me to start using UUIDv7?

6d03,
@6d03@mathstodon.xyz avatar

@hongminhee Did they finalize the RFC yet?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • mastodon
  • ethstaker
  • thenastyranch
  • GTA5RPClips
  • everett
  • Durango
  • rosin
  • InstantRegret
  • DreamBathrooms
  • magazineikmin
  • Youngstown
  • mdbf
  • slotface
  • cisconetworking
  • kavyap
  • JUstTest
  • normalnudes
  • modclub
  • cubers
  • ngwrru68w68
  • khanakhh
  • tacticalgear
  • tester
  • provamag3
  • Leos
  • osvaldo12
  • anitta
  • megavids
  • lostlight
  • All magazines