ZIm/crates/extension_api/wit/since_v0.1.0/http-client.wit
Marshall Bowers 98a2ab0686
zed_extension_api: Bump to v0.1.0 (#16158)
This PR changes v0.0.7 of the extension API to v0.1.0.

We had a false-start in releasing v0.0.7, which has since been yanked,
so we need a new version number. We'll publish v0.1.0 to crates.io once
the Preview build is out tomorrow.

We're incrementing the minor version so that we have some leeway in
putting out patch releases of the crate within a given extension API
release.

Release Notes:

- N/A
2024-08-13 10:04:34 -04:00

45 lines
1.2 KiB
Text

interface http-client {
/// An HTTP request.
record http-request {
/// The HTTP method for the request.
method: http-method,
/// The URL to which the request should be made.
url: string,
/// Headers for the request.
headers: list<tuple<string, string>>,
/// The request body.
body: option<list<u8>>,
}
/// HTTP methods.
enum http-method {
get,
post,
put,
delete,
head,
options,
patch,
}
/// An HTTP response.
record http-response {
/// The response headers.
headers: list<tuple<string, string>>,
/// The response body.
body: list<u8>,
}
/// Performs an HTTP request and returns the response.
fetch: func(req: http-request) -> result<http-response, string>;
/// An HTTP response stream.
resource http-response-stream {
/// Retrieves the next chunk of data from the response stream.
/// Returns None if the stream has ended.
next-chunk: func() -> result<option<list<u8>>, string>;
}
/// Performs an HTTP request and returns a response stream.
fetch-stream: func(req: http-request) -> result<http-response-stream, string>;
}