module Api
Runtime-generated Matrix Client-Server API built from official OpenAPI schemas.
Loads the OpenAPI 3.1.0 YAML files from data/matrix-spec/api/client-server/ at require-time and builds a PathTree trie of all valid endpoints. API calls are constructed via StringBuilder method chains, validated against the tree, and terminated by .get(), .post(), .put(), or .delete().
Usage:
Via Client:
client.api.account.whoami.get client.api.createRoom.post(name: "Pub", preset: "public_chat") client.api.rooms("!room:ex.com").ban.post(user_id: "@bad:ex.com") client.api.rooms("!room:ex.com").messages.get(dir: "b", limit: 10)
Standalone (for inspection):
gateway = Async::Matrix::Api::Gateway.new(client) chain = gateway.chain chain.rooms("!room:ex.com").state("m.room.name", "").get
Nested
Definitions
def self.path_tree
The shared PathTree instance, loaded once from the bundled schemas.
Implementation
def self.path_tree
@path_tree ||= PathTree.load
end
def self.reset!
Reset the cached path tree (useful for testing or reloading schemas).
Implementation
def self.reset!
@path_tree = nil
end