cloudflare/endpoints/workerskv/
create_namespace.rs1use super::WorkersKvNamespace;
2
3use surf::http::Method;
4
5use crate::framework::endpoint::Endpoint;
6
7#[derive(Debug)]
13pub struct CreateNamespace<'a> {
14 pub account_identifier: &'a str,
15 pub params: CreateNamespaceParams,
16}
17
18impl<'a> Endpoint<WorkersKvNamespace, (), CreateNamespaceParams> for CreateNamespace<'a> {
19 fn method(&self) -> Method {
20 Method::Post
21 }
22 fn path(&self) -> String {
23 format!("accounts/{}/storage/kv/namespaces", self.account_identifier)
24 }
25 fn body(&self) -> Option<CreateNamespaceParams> {
26 Some(self.params.clone())
27 }
28}
29
30#[derive(Serialize, Clone, Debug)]
31pub struct CreateNamespaceParams {
32 pub title: String,
33}