grafbase_sdk/types/
authentication.rs1use crate::wit;
2
3use super::OwnedHttpHeaders;
4
5#[non_exhaustive]
7pub struct PublicMetadataEndpoint {
8 path: String,
10 response_body: Vec<u8>,
12 response_headers: OwnedHttpHeaders,
14}
15
16impl PublicMetadataEndpoint {
17 pub fn new(path: String, response_body: Vec<u8>) -> Self {
19 PublicMetadataEndpoint {
20 path,
21 response_body,
22 response_headers: Default::default(),
23 }
24 }
25
26 pub fn with_headers(mut self, response_headers: OwnedHttpHeaders) -> Self {
28 self.response_headers = response_headers;
29 self
30 }
31
32 pub fn response_headers_mut(&mut self) -> &mut OwnedHttpHeaders {
34 &mut self.response_headers
35 }
36}
37
38impl From<wit::PublicMetadataEndpoint> for PublicMetadataEndpoint {
39 fn from(
40 wit::PublicMetadataEndpoint {
41 path,
42 response_body,
43 response_headers,
44 }: wit::PublicMetadataEndpoint,
45 ) -> Self {
46 PublicMetadataEndpoint {
47 path,
48 response_body,
49 response_headers: response_headers.into(),
50 }
51 }
52}
53
54impl From<PublicMetadataEndpoint> for wit::PublicMetadataEndpoint {
55 fn from(
56 PublicMetadataEndpoint {
57 path,
58 response_body,
59 response_headers,
60 }: PublicMetadataEndpoint,
61 ) -> Self {
62 wit::PublicMetadataEndpoint {
63 path,
64 response_body,
65 response_headers: response_headers.into(),
66 }
67 }
68}