cloudflare/endpoints/workerskv/
read_key.rs1use crate::framework::endpoint::EndpointSpec;
2use crate::framework::endpoint::Method;
3use crate::framework::response::ApiResult;
4
5#[derive(Debug)]
13pub struct ReadKey<'a> {
14 pub account_identifier: &'a str,
15 pub namespace_identifier: &'a str,
16 pub key: &'a str,
17}
18
19impl ApiResult for Vec<u8> {}
20
21impl EndpointSpec for ReadKey<'_> {
22 const IS_RAW_BODY: bool = true;
23
24 type JsonResponse = ();
25 type ResponseType = Vec<u8>;
26
27 fn method(&self) -> Method {
28 Method::GET
29 }
30 fn path(&self) -> String {
31 format!(
32 "accounts/{}/storage/kv/namespaces/{}/values/{}",
33 self.account_identifier,
34 self.namespace_identifier,
35 super::url_encode_key(self.key)
36 )
37 }
38}