kord icon indicating copy to clipboard operation
kord copied to clipboard

Use Ktor resources instead of own Route objects

Open DRSchlaubi opened this issue 3 years ago • 0 comments

Summary

With the release of Ktor 2.0.0 the old location API was replaced by the new resource API which comes with a lot of advantages. The two most important being

  • It uses Kotlinx.serialization, so now we can add parameters with _ in them without violating Kotlin naming conventions (as now there is @SerialName
  • It is now also available to the client and MPP

Consideration

Currently, kord-rest is not entirely dependent on Ktor, you should be able to write your own RequestHandler, which does not use Ktor, however realistically no one is going to do that anyway, and you need to use Ktor for all other parts of Kord already

Challenges

Rate limiting

The existing Route objects are also used for rate limiting, and I am currently not sure whether we can still store all of the rate limiting information

Serialization

Until now, Routes also stored the request method and the body type, this might need to change

DRSchlaubi avatar Apr 10 '22 17:04 DRSchlaubi