async-matrixSourceAsyncDiscordApi

module Api

Runtime-generated Discord HTTP API built from the official OpenAPI spec.

Loads the OpenAPI 3.1.0 JSON file from data/discord-api-spec/openapi.json at require-time and builds a PathTree trie of all valid endpoints. API calls are constructed via method chains (reusing Async::Matrix::Api::Chain), validated against the tree, and terminated by .get(), .post(), .put(), .patch(), or .delete().

Usage: client.api.channels("123456").messages.post(content: "hello") client.api.guilds("789").members.get(limit: 100) client.api.users("@me").get

Nested

Definitions

def self.path_tree

The shared PathTree instance, loaded once from the bundled spec.

Implementation

def self.path_tree
  @path_tree ||= PathTree.load
end

def self.reset!

Reset the cached path tree (useful for testing or reloading).

Implementation

def self.reset!
  @path_tree = nil
end