wrangler 1.21.0

Command-line interface for all things Cloudflare Workers
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use cloudflare::endpoints::workerskv::create_namespace::CreateNamespace;
use cloudflare::endpoints::workerskv::create_namespace::CreateNamespaceParams;
use cloudflare::endpoints::workerskv::WorkersKvNamespace;
use cloudflare::framework::apiclient::ApiClient;
use cloudflare::framework::response::{ApiFailure, ApiSuccess};

pub fn create(
    client: &impl ApiClient,
    account_id: &str,
    title: &str,
) -> Result<ApiSuccess<WorkersKvNamespace>, ApiFailure> {
    client.request(&CreateNamespace {
        account_identifier: account_id,
        params: CreateNamespaceParams {
            title: title.to_string(),
        },
    })
}