module Kagi::Request
Overview
HTTP::Client
wrapper methods for interacting with the Kagi API
Defined in:
kagi/request.crConstant Summary
-
Log =
Kagi::Log.for(self)
Class Method Summary
-
.api_version : String
Gets the current API version, defaulting to "v0"
-
.api_version=(version : String)
Set the API version to be used for queries
-
.get(path : String, params : String) : HTTP::Client::Response
Perform a get request to a given path with params, attaching the API key set via
KAGI_API_KEY
. -
.post(path : String, body : String, headers : HTTP::Headers | Nil = nil) : HTTP::Client::Response
Perform a post request to a given path, body, and optional headers, attaching the API key set via
KAGI_API_KEY
.
Class Method Detail
def self.get(path : String, params : String) : HTTP::Client::Response
#
Perform a get request to a given path with params, attaching the API key set via KAGI_API_KEY
.
Raises an exception if the request was unsuccessful.
def self.post(path : String, body : String, headers : HTTP::Headers | Nil = nil) : HTTP::Client::Response
#
Perform a post request to a given path, body, and optional headers, attaching the API key set via KAGI_API_KEY
.
Raises an exception if the request was unsuccessful.