// SPDX-License-Identifier: MIT
package greentic:http@1.0.0;
interface http-client {
use greentic:interfaces-types/types@0.1.0.{tenant-ctx};
/// Canonical host error payload.
record host-error {
code: string,
message: string,
}
/// HTTP request issued by a component.
record request {
method: string,
url: string,
headers: list<tuple<string, string>>,
body: option<list<u8>>,
}
/// HTTP response returned by the host.
record response {
status: u16,
headers: list<tuple<string, string>>,
body: option<list<u8>>,
}
/// Issues an HTTP request using the host's networking stack.
send: func(req: request, ctx: option<tenant-ctx>) -> result<response, host-error>;
}
world client {
import http-client;
}