grafbase_sdk/types/
hooks.rs1use crate::{types::Headers, wit};
2
3#[non_exhaustive]
5pub struct HttpRequestParts {
6 pub url: String,
8 pub method: http::Method,
10 pub headers: Headers,
12}
13
14impl From<wit::HttpRequestParts> for HttpRequestParts {
15 fn from(parts: wit::HttpRequestParts) -> Self {
16 Self {
17 url: parts.url,
18 method: parts.method.into(),
19 headers: parts.headers.into(),
20 }
21 }
22}
23
24impl From<HttpRequestParts> for wit::HttpRequestParts {
25 fn from(parts: HttpRequestParts) -> Self {
26 Self {
27 url: parts.url,
28 method: parts.method.into(),
29 headers: parts.headers.into(),
30 }
31 }
32}
33
34#[derive(Default)]
36pub struct OnRequestOutput {
37 pub(crate) contract_key: Option<String>,
38}
39
40impl OnRequestOutput {
41 pub fn new() -> Self {
43 Self::default()
44 }
45
46 pub fn contract_key(mut self, contract_key: String) -> Self {
48 self.contract_key = Some(contract_key);
49 self
50 }
51}