Òtúrá 1011

The Messenger — Networking

Methods

get / gba

Otura.get(url: String) ? String

HTTP GET request, returns response body.

ayanmo response = Otura.get("https://api.example.com/data");
Irosu.fo(response);

post / firan??

Otura.post(url: String, body: String) ? String

HTTP POST request with body.

ayanmo data = "{\"name\": \"Ifá\"}";
ayanmo response = Otura.post("https://api.example.com/submit", data);
Irosu.fo(response);

download / gbale

Otura.download(url: String, path: String) ? Bool

Download file to local path.

ayanmo ok = Otura.download(
    "https://example.com/file.zip",
    "downloads/file.zip"
);
ti (ok) {
    Irosu.fo("Download complete!");
}

parse_json / ?e_json

Otura.parse_json(json: String) ? Any

Parse JSON string to value.

ayanmo json = "{\"count\": 42}";
ayanmo data = Otura.parse_json(json);
// Access: data.count

parse_url / ?e_url

Otura.parse_url(url: String) ? Object

Parse URL into components.

ayanmo parts = Otura.parse_url("https://example.com:8080/path?q=1");
// parts.host = "example.com"
// parts.port = 8080
// parts.path = "/path"

Example: API Call

// Fetch data from API
ayanmo url = "https://api.quotable.io/random";
ayanmo response = Otura.get(url);

Irosu.fo("Response:");
Irosu.fo(response);

// Parse JSON response
ayanmo data = Otura.parse_json(response);
Irosu.fo("Quote received!");