Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T06:11:05.646Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

http-client.wit

68 lines · 1.9 KB · text
1interface http-client {
2    /// An HTTP request.
3    record http-request {
4        /// The HTTP method for the request.
5        method: http-method,
6        /// The URL to which the request should be made.
7        url: string,
8        /// The headers for the request.
9        headers: list<tuple<string, string>>,
10        /// The request body.
11        body: option<list<u8>>,
12        /// The policy to use for redirects.
13        redirect-policy: redirect-policy,
14    }
15
16    /// HTTP methods.
17    enum http-method {
18        /// `GET`
19        get,
20        /// `HEAD`
21        head,
22        /// `POST`
23        post,
24        /// `PUT`
25        put,
26        /// `DELETE`
27        delete,
28        /// `OPTIONS`
29        options,
30        /// `PATCH`
31        patch,
32    }
33
34    /// The policy for dealing with redirects received from the server.
35    variant redirect-policy {
36        /// Redirects from the server will not be followed.
37        ///
38        /// This is the default behavior.
39        no-follow,
40        /// Redirects from the server will be followed up to the specified limit.
41        follow-limit(u32),
42        /// All redirects from the server will be followed.
43        follow-all,
44    }
45
46    /// An HTTP response.
47    record http-response {
48        /// The response headers.
49        headers: list<tuple<string, string>>,
50        /// The response body.
51        body: list<u8>,
52    }
53
54    /// Performs an HTTP request and returns the response.
55    fetch: func(req: http-request) -> result<http-response, string>;
56
57    /// An HTTP response stream.
58    resource http-response-stream {
59        /// Retrieves the next chunk of data from the response stream.
60        ///
61        /// Returns `Ok(None)` if the stream has ended.
62        next-chunk: func() -> result<option<list<u8>>, string>;
63    }
64
65    /// Performs an HTTP request and returns a response stream.
66    fetch-stream: func(req: http-request) -> result<http-response-stream, string>;
67}
68
Served at tenant.openagents/omega Member data and write actions are omitted.