// AUTO-GENERATED by scripts/generate.ts from .generated-specs. Do not edit. import * as S from "@distilled.cloud/core/schema"; import * as API from "@distilled.cloud/core/api"; import * as T from "../traits.ts"; import { CloudflareProtocol, CloudflarePaginatedProtocol, type CloudflareOpError, type CloudflareOpContext, } from "../protocol.ts"; import { cloudflarePaginate, ResultInfo } from "../pagination.ts"; import { CloudflareError, CloudflareRateLimited } from "../errors.ts"; import * as Retry from "../retry.ts"; export type { CloudflareOpError, CloudflareOpContext }; /** Fallback camelCase→wire mapping for opaque content (mined from the distilled SDK). */ const KEY_DICTIONARY: Record> = { expirationTtl: "expiration_ttl", perPage: "per_page", resultInfo: "result_info", successfulKeyCount: "successful_key_count", supportsUrlEncoding: "supports_url_encoding", totalCount: "total_count", unsuccessfulKeys: "unsuccessful_keys", }; export class InvalidExpirationTtl extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "InvalidExpirationTtl", { code: S.Number, message: S.String, }, ), [{ code: 10034 }], ) {} export class InvalidObjectIdentifier extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "InvalidObjectIdentifier", { code: S.Number, message: S.String, }, ), [{ code: 7003 }], ) {} export class InvalidRequestBody extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("InvalidRequestBody", { code: S.Number, message: S.String, }), [{ code: 10012 }], ) {} export class KeyNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("KeyNotFound", { code: S.Number, message: S.String, }), [{ code: 10009 }], ) {} export class MethodNotAllowed extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("MethodNotAllowed", { code: S.Number, message: S.String, }), [ { code: 10405, message: { includes: "not allowed" } }, { code: 10000, message: { includes: "not allowed" } }, ], ) {} export class MinimumKeysRequired extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("MinimumKeysRequired", { code: S.Number, message: S.String, }), [{ code: 10029 }], ) {} export class NamespaceNotFound extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("NamespaceNotFound", { code: S.Number, message: S.String, }), [{ code: 10013 }], ) {} export class NamespaceTitleAlreadyExists extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()( "NamespaceTitleAlreadyExists", { code: S.Number, message: S.String, }, ), [{ code: 10014 }], ) {} export class TitleRequired extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("TitleRequired", { code: S.Number, message: S.String, }), [{ code: 10019 }], ) {} export type NamespacesBulkDeleteRequestBodyList = Array; export const NamespacesBulkDeleteRequestBodyList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface BulkDeleteNamespacesRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; body: NamespacesBulkDeleteRequestBodyList; } export const BulkDeleteNamespacesRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), body: NamespacesBulkDeleteRequestBodyList.pipe(T.HttpBody()), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/delete", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "BulkDeleteNamespacesRequest", }) as any as S.Schema; export type NamespacesBulkDeleteResponseUnsuccessfulKeysList = Array; export const NamespacesBulkDeleteResponseUnsuccessfulKeysList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface BulkDeleteNamespacesResponse { /** Number of keys successfully updated. */ successfulKeyCount?: number | null; /** Name of the keys that failed to be fully updated. They should be retried. */ unsuccessfulKeys?: NamespacesBulkDeleteResponseUnsuccessfulKeysList | null; } export const BulkDeleteNamespacesResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ successfulKeyCount: S.optional( S.NullOr(S.Number).pipe(T.Body("successful_key_count")), ), unsuccessfulKeys: S.optional( S.NullOr(NamespacesBulkDeleteResponseUnsuccessfulKeysList).pipe( T.Body("unsuccessful_keys"), ), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "BulkDeleteNamespacesResponse", }) as any as S.Schema; export type NamespacesBulkGetRequestKeysList = Array; export const NamespacesBulkGetRequestKeysList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type NamespacesBulkGetRequestType = "text" | "json"; export const NamespacesBulkGetRequestType = /*@__PURE__*/ S.String; export interface BulkGetNamespacesRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; /** Array of keys to retrieve (maximum of 100). */ keys: NamespacesBulkGetRequestKeysList; /** Whether to parse JSON values in the response. */ type?: NamespacesBulkGetRequestType | (string & {}); /** Whether to include metadata in the response. */ withMetadata?: boolean; } export const BulkGetNamespacesRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), keys: NamespacesBulkGetRequestKeysList, type: S.optional(NamespacesBulkGetRequestType), withMetadata: S.optional(S.Boolean), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/get", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "BulkGetNamespacesRequest", }) as any as S.Schema; export type NamespacesBulkGetResultWorkersKVBulkGetResultValuesCase3Map = { [key: string]: unknown | undefined; }; export const NamespacesBulkGetResultWorkersKVBulkGetResultValuesCase3Map = /*@__PURE__*/ S.Record( S.String, S.Unknown, ) as any as S.Schema; export type NamespacesBulkGetResultWorkersKVBulkGetResultValues = | string | number | boolean | NamespacesBulkGetResultWorkersKVBulkGetResultValuesCase3Map; export const NamespacesBulkGetResultWorkersKVBulkGetResultValues = /*@__PURE__*/ S.Unknown.pipe(T.UnionCases([[], [], [], []])); export interface NamespacesBulkGetResultWorkersKVBulkGetResult { /** Requested keys are paired with their values in an object. */ values?: NamespacesBulkGetResultWorkersKVBulkGetResultValues | null; } export const NamespacesBulkGetResultWorkersKVBulkGetResult = /*@__PURE__*/ S.suspend(() => S.Struct({ values: S.optional( S.NullOr(NamespacesBulkGetResultWorkersKVBulkGetResultValues), ), }), ).annotate({ identifier: "NamespacesBulkGetResultWorkersKVBulkGetResult", }) as any as S.Schema; export interface NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue { /** The metadata associated with the key. */ metadata: unknown; /** The value associated with the key. */ value: unknown; /** Expires the key at a certain time, measured in number of seconds since the UNIX epoch. */ expiration?: number | null; } export const NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue = /*@__PURE__*/ S.suspend(() => S.Struct({ metadata: S.Unknown, value: S.Unknown, expiration: S.optional(S.NullOr(S.Number)), }), ).annotate({ identifier: "NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue", }) as any as S.Schema; export type NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesMap = { [key: string]: | NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue | undefined; }; export const NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesMap = /*@__PURE__*/ S.Record( S.String, NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue, ) as any as S.Schema; export interface NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadata { /** Requested keys are paired with their values and metadata in an object. */ values?: NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesMap | null; } export const NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadata = /*@__PURE__*/ S.suspend(() => S.Struct({ values: S.optional( S.NullOr( NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesMap, ), ), }), ).annotate({ identifier: "NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadata", }) as any as S.Schema; export type NamespacesBulkGetResult = | NamespacesBulkGetResultWorkersKVBulkGetResult | NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadata; export const NamespacesBulkGetResult = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([["values"], ["values"]]), ); export type BulkGetNamespacesResponse = NamespacesBulkGetResult; export const BulkGetNamespacesResponse = /*@__PURE__*/ S.suspend(() => NamespacesBulkGetResult.pipe( T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY), ), ).annotate({ identifier: "BulkGetNamespacesResponse", }) as any as S.Schema; export interface NamespacesBulkUpdateRequestBodyItem { /** A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. */ key: string; /** A UTF-8 encoded string to be stored, up to 25 MiB in length. */ value: string; /** Indicates whether or not the server should base64 decode the value before storing it. Useful for writing values that wouldn't otherwise be valid JSON strings, such as images. */ base64?: boolean; /** Expires the key at a certain time, measured in number of seconds since the UNIX epoch. */ expiration?: number; /** Expires the key after a number of seconds. Must be at least 60. */ expirationTtl?: number; /** Arbitrary JSON that is associated with a key. */ metadata?: unknown; } export const NamespacesBulkUpdateRequestBodyItem = /*@__PURE__*/ S.suspend(() => S.Struct({ key: S.String, value: S.String, base64: S.optional(S.Boolean), expiration: S.optional(S.Number), expirationTtl: S.optional(S.Number.pipe(T.Body("expiration_ttl"))), metadata: S.optional(S.Unknown), }), ).annotate({ identifier: "NamespacesBulkUpdateRequestBodyItem", }) as any as S.Schema; export type NamespacesBulkUpdateRequestBodyList = Array; export const NamespacesBulkUpdateRequestBodyList = /*@__PURE__*/ S.Array( NamespacesBulkUpdateRequestBodyItem, ) as any as S.Schema; export interface BulkPutNamespacesRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; body: NamespacesBulkUpdateRequestBodyList; } export const BulkPutNamespacesRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), body: NamespacesBulkUpdateRequestBodyList.pipe(T.HttpBody()), }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "BulkPutNamespacesRequest", }) as any as S.Schema; export type NamespacesBulkUpdateResponseUnsuccessfulKeysList = Array; export const NamespacesBulkUpdateResponseUnsuccessfulKeysList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface BulkPutNamespacesResponse { /** Number of keys successfully updated. */ successfulKeyCount?: number | null; /** Name of the keys that failed to be fully updated. They should be retried. */ unsuccessfulKeys?: NamespacesBulkUpdateResponseUnsuccessfulKeysList | null; } export const BulkPutNamespacesResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ successfulKeyCount: S.optional( S.NullOr(S.Number).pipe(T.Body("successful_key_count")), ), unsuccessfulKeys: S.optional( S.NullOr(NamespacesBulkUpdateResponseUnsuccessfulKeysList).pipe( T.Body("unsuccessful_keys"), ), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "BulkPutNamespacesResponse", }) as any as S.Schema; export interface CreateNamespaceRequest { /** Identifier. */ accountId: string; /** A human-readable string name for a Namespace. */ title: string; } export const CreateNamespaceRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), title: S.String, }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/storage/kv/namespaces", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateNamespaceRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface CreateNamespaceResponse { /** Namespace identifier tag. */ id: string; /** A human-readable string name for a Namespace. */ title: string; /** True if keys written on the URL will be URL-decoded before storing. For example, if set to "true", a key written on the URL as "%3F" will be stored as "?". */ supportsUrlEncoding?: boolean | null; } export const CreateNamespaceResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, title: S.String, supportsUrlEncoding: S.optional( S.NullOr(S.Boolean).pipe(T.Body("supports_url_encoding")), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateNamespaceResponse", }) as any as S.Schema; export interface DeleteNamespaceRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; } export const DeleteNamespaceRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteNamespaceRequest", }) as any as S.Schema; export interface DeleteNamespaceResponse {} export const DeleteNamespaceResponse = /*@__PURE__*/ S.suspend(() => S.Struct({}).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteNamespaceResponse", }) as any as S.Schema; export interface DeleteNamespaceValueRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; /** A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL. */ keyName: string; } export const DeleteNamespaceValueRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), keyName: S.String.pipe(T.Label("key_name")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteNamespaceValueRequest", }) as any as S.Schema; export interface DeleteNamespaceValueResponse {} export const DeleteNamespaceValueResponse = /*@__PURE__*/ S.suspend(() => S.Struct({}).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteNamespaceValueResponse", }) as any as S.Schema; export interface GetNamespaceRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; } export const GetNamespaceRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetNamespaceRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetNamespaceResponse { /** Namespace identifier tag. */ id: string; /** A human-readable string name for a Namespace. */ title: string; /** True if keys written on the URL will be URL-decoded before storing. For example, if set to "true", a key written on the URL as "%3F" will be stored as "?". */ supportsUrlEncoding?: boolean | null; } export const GetNamespaceResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, title: S.String, supportsUrlEncoding: S.optional( S.NullOr(S.Boolean).pipe(T.Body("supports_url_encoding")), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetNamespaceResponse", }) as any as S.Schema; export interface GetNamespaceMetadataRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; /** A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL. */ keyName: string; } export const GetNamespaceMetadataRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), keyName: S.String.pipe(T.Label("key_name")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/metadata/{key_name}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetNamespaceMetadataRequest", }) as any as S.Schema; export type GetNamespaceMetadataResponse = unknown; export const GetNamespaceMetadataResponse = /*@__PURE__*/ S.suspend(() => S.Unknown.pipe(T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetNamespaceMetadataResponse", }) as any as S.Schema; export interface GetNamespaceValueRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; /** A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL. */ keyName: string; } export const GetNamespaceValueRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), keyName: S.String.pipe(T.Label("key_name")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetNamespaceValueRequest", }) as any as S.Schema; export interface GetNamespaceValueResponse { /** Raw value body as an Effect Stream. */ body: T.BinaryResponseBody; /** Expiration time of the KV pair, seconds since the UNIX epoch (set when the pair is set to expire). */ expiration?: number; /** MIME type the value was stored with. */ contentType?: string; } export const GetNamespaceValueResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ body: S.Unknown.pipe(T.BinaryResponseBody()), expiration: S.optional(S.Number.pipe(T.Header())), contentType: S.optional(S.String.pipe(T.Header("content-type"))), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetNamespaceValueResponse", }) as any as S.Schema; export interface ListNamespaceKeysRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; /** Opaque token indicating the position from which to continue when requesting the next set of records if the amount of list results was limited by the limit parameter. A valid value for the cursor can be obtained from the `cursors` object in the `result_info` structure. */ cursor?: string; /** Limits the number of keys returned in the response. The cursor attribute may be used to iterate over the next batch of keys if there are more than the limit. */ limit?: number; /** Filters returned keys by a name prefix. Exact matches and any key names that begin with the prefix will be returned. */ prefix?: string; } export const ListNamespaceKeysRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), cursor: S.optional(S.String.pipe(T.Query())), limit: S.optional(S.Number.pipe(T.Query())), prefix: S.optional(S.String.pipe(T.Query())), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/keys", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListNamespaceKeysRequest", }) as any as S.Schema; export interface NamespacesKeysListResultItem { /** A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL. */ name: string; /** The time, measured in number of seconds since the UNIX epoch, at which the key will expire. This property is omitted for keys that will not expire. */ expiration?: number | null; /** Arbitrary JSON that is associated with a key. */ metadata?: unknown | null; } export const NamespacesKeysListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ name: S.String, expiration: S.optional(S.NullOr(S.Number)), metadata: S.optional(S.NullOr(S.Unknown)), }), ).annotate({ identifier: "NamespacesKeysListResultItem", }) as any as S.Schema; export type NamespacesKeysListResultList = Array; export const NamespacesKeysListResultList = /*@__PURE__*/ S.Array( NamespacesKeysListResultItem, ) as any as S.Schema; export interface ListNamespaceKeysResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: NamespacesKeysListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListNamespaceKeysResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: NamespacesKeysListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListNamespaceKeysResponse", }) as any as S.Schema; export type NamespacesListRequestDirection = "asc" | "desc"; export const NamespacesListRequestDirection = /*@__PURE__*/ S.String; export type NamespacesListRequestOrder = "id" | "title"; export const NamespacesListRequestOrder = /*@__PURE__*/ S.String; export interface ListNamespacesRequest { /** Identifier. */ accountId: string; /** Direction to order namespaces. */ direction?: NamespacesListRequestDirection | (string & {}); /** Field to order results by. */ order?: NamespacesListRequestOrder | (string & {}); /** Page number of paginated results. */ page?: number; /** Maximum number of results per page. */ perPage?: number; } export const ListNamespacesRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), direction: S.optional(NamespacesListRequestDirection.pipe(T.Query())), order: S.optional(NamespacesListRequestOrder.pipe(T.Query())), page: S.optional(S.Number.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/storage/kv/namespaces", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListNamespacesRequest", }) as any as S.Schema; export interface NamespacesListResultItem { /** Namespace identifier tag. */ id: string; /** A human-readable string name for a Namespace. */ title: string; /** True if keys written on the URL will be URL-decoded before storing. For example, if set to "true", a key written on the URL as "%3F" will be stored as "?". */ supportsUrlEncoding?: boolean | null; } export const NamespacesListResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, title: S.String, supportsUrlEncoding: S.optional( S.NullOr(S.Boolean).pipe(T.Body("supports_url_encoding")), ), }), ).annotate({ identifier: "NamespacesListResultItem", }) as any as S.Schema; export type NamespacesListResultList = Array; export const NamespacesListResultList = /*@__PURE__*/ S.Array( NamespacesListResultItem, ) as any as S.Schema; export interface ListNamespacesResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: NamespacesListResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ListNamespacesResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: NamespacesListResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListNamespacesResponse", }) as any as S.Schema; export type NamespacesKeysBulkDeleteRequestBodyList = Array; export const NamespacesKeysBulkDeleteRequestBodyList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface NamespacesKeysBulkDeleteRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; body: NamespacesKeysBulkDeleteRequestBodyList; } export const NamespacesKeysBulkDeleteRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), body: NamespacesKeysBulkDeleteRequestBodyList.pipe(T.HttpBody()), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/delete", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "NamespacesKeysBulkDeleteRequest", }) as any as S.Schema; export type NamespacesKeysBulkDeleteResponseUnsuccessfulKeysList = Array; export const NamespacesKeysBulkDeleteResponseUnsuccessfulKeysList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface NamespacesKeysBulkDeleteResponse { /** Number of keys successfully updated. */ successfulKeyCount?: number | null; /** Name of the keys that failed to be fully updated. They should be retried. */ unsuccessfulKeys?: NamespacesKeysBulkDeleteResponseUnsuccessfulKeysList | null; } export const NamespacesKeysBulkDeleteResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ successfulKeyCount: S.optional( S.NullOr(S.Number).pipe(T.Body("successful_key_count")), ), unsuccessfulKeys: S.optional( S.NullOr(NamespacesKeysBulkDeleteResponseUnsuccessfulKeysList).pipe( T.Body("unsuccessful_keys"), ), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "NamespacesKeysBulkDeleteResponse", }) as any as S.Schema; export type NamespacesKeysBulkGetRequestKeysList = Array; export const NamespacesKeysBulkGetRequestKeysList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export type NamespacesKeysBulkGetRequestType = "text" | "json"; export const NamespacesKeysBulkGetRequestType = /*@__PURE__*/ S.String; export interface NamespacesKeysBulkGetRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; /** Array of keys to retrieve (maximum of 100). */ keys: NamespacesKeysBulkGetRequestKeysList; /** Whether to parse JSON values in the response. */ type?: NamespacesKeysBulkGetRequestType | (string & {}); /** Whether to include metadata in the response. */ withMetadata?: boolean; } export const NamespacesKeysBulkGetRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), keys: NamespacesKeysBulkGetRequestKeysList, type: S.optional(NamespacesKeysBulkGetRequestType), withMetadata: S.optional(S.Boolean), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk/get", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "NamespacesKeysBulkGetRequest", }) as any as S.Schema; export type NamespacesKeysBulkGetResultWorkersKVBulkGetResultValuesCase3Map = { [key: string]: unknown | undefined; }; export const NamespacesKeysBulkGetResultWorkersKVBulkGetResultValuesCase3Map = /*@__PURE__*/ S.Record( S.String, S.Unknown, ) as any as S.Schema; export type NamespacesKeysBulkGetResultWorkersKVBulkGetResultValues = | string | number | boolean | NamespacesKeysBulkGetResultWorkersKVBulkGetResultValuesCase3Map; export const NamespacesKeysBulkGetResultWorkersKVBulkGetResultValues = /*@__PURE__*/ S.Unknown.pipe(T.UnionCases([[], [], [], []])); export interface NamespacesKeysBulkGetResultWorkersKVBulkGetResult { /** Requested keys are paired with their values in an object. */ values?: NamespacesKeysBulkGetResultWorkersKVBulkGetResultValues | null; } export const NamespacesKeysBulkGetResultWorkersKVBulkGetResult = /*@__PURE__*/ S.suspend(() => S.Struct({ values: S.optional( S.NullOr(NamespacesKeysBulkGetResultWorkersKVBulkGetResultValues), ), }), ).annotate({ identifier: "NamespacesKeysBulkGetResultWorkersKVBulkGetResult", }) as any as S.Schema; export type NamespacesKeysBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue = NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue; export const NamespacesKeysBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue = NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue; export type NamespacesKeysBulkGetResultWorkersKVBulkGetResultWithMetadataValuesMap = { [key: string]: | NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue | undefined; }; export const NamespacesKeysBulkGetResultWorkersKVBulkGetResultWithMetadataValuesMap = /*@__PURE__*/ S.Record( S.String, NamespacesBulkGetResultWorkersKVBulkGetResultWithMetadataValuesValue, ) as any as S.Schema; export interface NamespacesKeysBulkGetResultWorkersKVBulkGetResultWithMetadata { /** Requested keys are paired with their values and metadata in an object. */ values?: NamespacesKeysBulkGetResultWorkersKVBulkGetResultWithMetadataValuesMap | null; } export const NamespacesKeysBulkGetResultWorkersKVBulkGetResultWithMetadata = /*@__PURE__*/ S.suspend(() => S.Struct({ values: S.optional( S.NullOr( NamespacesKeysBulkGetResultWorkersKVBulkGetResultWithMetadataValuesMap, ), ), }), ).annotate({ identifier: "NamespacesKeysBulkGetResultWorkersKVBulkGetResultWithMetadata", }) as any as S.Schema; export type NamespacesKeysBulkGetResult = | NamespacesKeysBulkGetResultWorkersKVBulkGetResult | NamespacesKeysBulkGetResultWorkersKVBulkGetResultWithMetadata; export const NamespacesKeysBulkGetResult = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([["values"], ["values"]]), ); export type NamespacesKeysBulkGetResponse = NamespacesKeysBulkGetResult; export const NamespacesKeysBulkGetResponse = /*@__PURE__*/ S.suspend(() => NamespacesKeysBulkGetResult.pipe( T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY), ), ).annotate({ identifier: "NamespacesKeysBulkGetResponse", }) as any as S.Schema; export type NamespacesKeysBulkUpdateRequestBodyItem = NamespacesBulkUpdateRequestBodyItem; export const NamespacesKeysBulkUpdateRequestBodyItem = NamespacesBulkUpdateRequestBodyItem; export type NamespacesKeysBulkUpdateRequestBodyList = Array; export const NamespacesKeysBulkUpdateRequestBodyList = /*@__PURE__*/ S.Array( NamespacesBulkUpdateRequestBodyItem, ) as any as S.Schema; export interface NamespacesKeysBulkUpdateRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; body: NamespacesKeysBulkUpdateRequestBodyList; } export const NamespacesKeysBulkUpdateRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), body: NamespacesKeysBulkUpdateRequestBodyList.pipe(T.HttpBody()), }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/bulk", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "NamespacesKeysBulkUpdateRequest", }) as any as S.Schema; export type NamespacesKeysBulkUpdateResponseUnsuccessfulKeysList = Array; export const NamespacesKeysBulkUpdateResponseUnsuccessfulKeysList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface NamespacesKeysBulkUpdateResponse { /** Number of keys successfully updated. */ successfulKeyCount?: number | null; /** Name of the keys that failed to be fully updated. They should be retried. */ unsuccessfulKeys?: NamespacesKeysBulkUpdateResponseUnsuccessfulKeysList | null; } export const NamespacesKeysBulkUpdateResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ successfulKeyCount: S.optional( S.NullOr(S.Number).pipe(T.Body("successful_key_count")), ), unsuccessfulKeys: S.optional( S.NullOr(NamespacesKeysBulkUpdateResponseUnsuccessfulKeysList).pipe( T.Body("unsuccessful_keys"), ), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "NamespacesKeysBulkUpdateResponse", }) as any as S.Schema; export interface PutNamespaceValueRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; /** A key's name. The name may be at most 512 bytes. All printable, non-whitespace characters are valid. Use percent-encoding to define key names as part of a URL. */ keyName: string; /** Expires the key at a certain time, measured in number of seconds since the UNIX epoch. */ expiration?: number; /** Expires the key after a number of seconds. Must be at least 60. */ expirationTtl?: number; /** A byte sequence to be stored, up to 25 MiB in length. */ value: string | File | Blob; /** Associates arbitrary JSON data with a key/value pair. */ metadata?: unknown; } export const PutNamespaceValueRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), keyName: S.String.pipe(T.Label("key_name")), expiration: S.optional(S.Number.pipe(T.Query())), expirationTtl: S.optional(S.Number.pipe(T.Query("expiration_ttl"))), value: S.String, metadata: S.optional(S.Unknown), }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}/values/{key_name}", code: 200, contentType: "multipart", }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PutNamespaceValueRequest", }) as any as S.Schema; export interface PutNamespaceValueResponse {} export const PutNamespaceValueResponse = /*@__PURE__*/ S.suspend(() => S.Struct({}).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "PutNamespaceValueResponse", }) as any as S.Schema; export interface UpdateNamespaceRequest { /** Identifier. */ accountId: string; /** Namespace identifier tag. */ namespaceId: string; /** A human-readable string name for a Namespace. */ title: string; } export const UpdateNamespaceRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), namespaceId: S.String.pipe(T.Label("namespace_id")), title: S.String, }) .pipe( T.Http({ method: "PUT", uri: "/accounts/{account_id}/storage/kv/namespaces/{namespace_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateNamespaceRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface UpdateNamespaceResponse { /** Namespace identifier tag. */ id: string; /** A human-readable string name for a Namespace. */ title: string; /** True if keys written on the URL will be URL-decoded before storing. For example, if set to "true", a key written on the URL as "%3F" will be stored as "?". */ supportsUrlEncoding?: boolean | null; } export const UpdateNamespaceResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, title: S.String, supportsUrlEncoding: S.optional( S.NullOr(S.Boolean).pipe(T.Body("supports_url_encoding")), ), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "UpdateNamespaceResponse", }) as any as S.Schema; export type BulkDeleteNamespacesError = | NamespaceNotFound | InvalidRequestBody | InvalidObjectIdentifier | CloudflareOpError; /** Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed. */ export const bulkDeleteNamespaces: API.OperationMethod< BulkDeleteNamespacesRequest, BulkDeleteNamespacesResponse, BulkDeleteNamespacesError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: BulkDeleteNamespacesRequest, output: BulkDeleteNamespacesResponse, errors: [ NamespaceNotFound, InvalidRequestBody, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type BulkGetNamespacesError = | InvalidRequestBody | MinimumKeysRequired | NamespaceNotFound | InvalidObjectIdentifier | CloudflareOpError; /** Retrieve up to 100 KV pairs from the namespace. Keys must contain text-based values. JSON values can optionally be parsed instead of being returned as a string value. Metadata can be included if `withMetadata` is true. */ export const bulkGetNamespaces: API.OperationMethod< BulkGetNamespacesRequest, BulkGetNamespacesResponse, BulkGetNamespacesError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: BulkGetNamespacesRequest, output: BulkGetNamespacesResponse, errors: [ InvalidRequestBody, MinimumKeysRequired, NamespaceNotFound, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type BulkPutNamespacesError = | InvalidRequestBody | NamespaceNotFound | InvalidObjectIdentifier | CloudflareOpError; /** Write multiple keys and values at once. Body should be an array of up to 10,000 key-value pairs to be stored, along with optional expiration information. Existing values and expirations will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. The entire request size must be 100 megabytes or less. */ export const bulkPutNamespaces: API.OperationMethod< BulkPutNamespacesRequest, BulkPutNamespacesResponse, BulkPutNamespacesError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: BulkPutNamespacesRequest, output: BulkPutNamespacesResponse, errors: [ InvalidRequestBody, NamespaceNotFound, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type CreateNamespaceError = | TitleRequired | InvalidObjectIdentifier | NamespaceTitleAlreadyExists | CloudflareOpError; /** Creates a namespace under the given title. A `400` is returned if the account already owns a namespace with this title. A namespace must be explicitly deleted to be replaced. */ export const createNamespace: API.OperationMethod< CreateNamespaceRequest, CreateNamespaceResponse, CreateNamespaceError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateNamespaceRequest, output: CreateNamespaceResponse, errors: [ TitleRequired, InvalidObjectIdentifier, NamespaceTitleAlreadyExists, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteNamespaceError = | MethodNotAllowed | NamespaceNotFound | InvalidObjectIdentifier | CloudflareOpError; /** Deletes the namespace corresponding to the given ID. */ export const deleteNamespace: API.OperationMethod< DeleteNamespaceRequest, DeleteNamespaceResponse, DeleteNamespaceError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteNamespaceRequest, output: DeleteNamespaceResponse, errors: [ MethodNotAllowed, NamespaceNotFound, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteNamespaceValueError = | NamespaceNotFound | InvalidObjectIdentifier | CloudflareOpError; /** Remove a KV pair from the namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. */ export const deleteNamespaceValue: API.OperationMethod< DeleteNamespaceValueRequest, DeleteNamespaceValueResponse, DeleteNamespaceValueError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteNamespaceValueRequest, output: DeleteNamespaceValueResponse, errors: [ NamespaceNotFound, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetNamespaceError = | NamespaceNotFound | InvalidObjectIdentifier | CloudflareOpError; /** Get the namespace corresponding to the given ID. */ export const getNamespace: API.OperationMethod< GetNamespaceRequest, GetNamespaceResponse, GetNamespaceError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetNamespaceRequest, output: GetNamespaceResponse, errors: [ NamespaceNotFound, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetNamespaceMetadataError = | KeyNotFound | NamespaceNotFound | InvalidObjectIdentifier | CloudflareOpError; /** Returns the metadata associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. */ export const getNamespaceMetadata: API.OperationMethod< GetNamespaceMetadataRequest, GetNamespaceMetadataResponse, GetNamespaceMetadataError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetNamespaceMetadataRequest, output: GetNamespaceMetadataResponse, errors: [ KeyNotFound, NamespaceNotFound, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetNamespaceValueError = | KeyNotFound | NamespaceNotFound | InvalidObjectIdentifier | CloudflareOpError; /** Returns the value associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. If the KV-pair is set to expire at some point, the expiration time as measured in seconds since the UNIX epoch will be returned in the `expiration` response header. */ export const getNamespaceValue: API.OperationMethod< GetNamespaceValueRequest, GetNamespaceValueResponse, GetNamespaceValueError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetNamespaceValueRequest, output: GetNamespaceValueResponse, errors: [ KeyNotFound, NamespaceNotFound, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListNamespaceKeysError = CloudflareOpError; /** Lists a namespace's keys. */ export const listNamespaceKeys: API.PaginatedOperationMethod< ListNamespaceKeysRequest, ListNamespaceKeysResponse, ListNamespaceKeysError, CloudflareOpContext, NamespacesKeysListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListNamespaceKeysRequest, output: ListNamespaceKeysResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "cursor", inputToken: "cursor", outputToken: "resultInfo.cursor", items: "result", pageSize: "limit", } as const, }), cloudflarePaginate, ) as any; export type ListNamespacesError = CloudflareOpError; /** Returns the namespaces owned by an account. */ export const listNamespaces: API.PaginatedOperationMethod< ListNamespacesRequest, ListNamespacesResponse, ListNamespacesError, CloudflareOpContext, NamespacesListResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ListNamespacesRequest, output: ListNamespacesResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "page", inputToken: "page", outputToken: "resultInfo.page", items: "result", pageSize: "perPage", } as const, }), cloudflarePaginate, ) as any; export type NamespacesKeysBulkDeleteError = | NamespaceNotFound | InvalidRequestBody | InvalidObjectIdentifier | CloudflareOpError; /** Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed. */ export const namespacesKeysBulkDelete: API.OperationMethod< NamespacesKeysBulkDeleteRequest, NamespacesKeysBulkDeleteResponse, NamespacesKeysBulkDeleteError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: NamespacesKeysBulkDeleteRequest, output: NamespacesKeysBulkDeleteResponse, errors: [ NamespaceNotFound, InvalidRequestBody, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type NamespacesKeysBulkGetError = | InvalidRequestBody | MinimumKeysRequired | NamespaceNotFound | InvalidObjectIdentifier | CloudflareOpError; /** Retrieve up to 100 KV pairs from the namespace. Keys must contain text-based values. JSON values can optionally be parsed instead of being returned as a string value. Metadata can be included if `withMetadata` is true. */ export const namespacesKeysBulkGet: API.OperationMethod< NamespacesKeysBulkGetRequest, NamespacesKeysBulkGetResponse, NamespacesKeysBulkGetError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: NamespacesKeysBulkGetRequest, output: NamespacesKeysBulkGetResponse, errors: [ InvalidRequestBody, MinimumKeysRequired, NamespaceNotFound, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type NamespacesKeysBulkUpdateError = | InvalidRequestBody | NamespaceNotFound | InvalidObjectIdentifier | CloudflareOpError; /** Write multiple keys and values at once. Body should be an array of up to 10,000 key-value pairs to be stored, along with optional expiration information. Existing values and expirations will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. The entire request size must be 100 megabytes or less. */ export const namespacesKeysBulkUpdate: API.OperationMethod< NamespacesKeysBulkUpdateRequest, NamespacesKeysBulkUpdateResponse, NamespacesKeysBulkUpdateError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: NamespacesKeysBulkUpdateRequest, output: NamespacesKeysBulkUpdateResponse, errors: [ InvalidRequestBody, NamespaceNotFound, InvalidObjectIdentifier, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type PutNamespaceValueError = | NamespaceNotFound | InvalidObjectIdentifier | InvalidExpirationTtl | CloudflareOpError; /** Write a value identified by a key. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. Body should be the value to be stored. If JSON metadata to be associated with the key/value pair is needed, use `multipart/form-data` content type for your PUT request (see dropdown below in `REQUEST BODY SCHEMA`). Existing values, expirations, and metadata will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. */ export const putNamespaceValue: API.OperationMethod< PutNamespaceValueRequest, PutNamespaceValueResponse, PutNamespaceValueError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: PutNamespaceValueRequest, output: PutNamespaceValueResponse, errors: [ NamespaceNotFound, InvalidObjectIdentifier, InvalidExpirationTtl, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type UpdateNamespaceError = | NamespaceNotFound | TitleRequired | InvalidObjectIdentifier | NamespaceTitleAlreadyExists | CloudflareOpError; /** Modifies a namespace's title. */ export const updateNamespace: API.OperationMethod< UpdateNamespaceRequest, UpdateNamespaceResponse, UpdateNamespaceError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: UpdateNamespaceRequest, output: UpdateNamespaceResponse, errors: [ NamespaceNotFound, TitleRequired, InvalidObjectIdentifier, NamespaceTitleAlreadyExists, CloudflareRateLimited, CloudflareError, ], protocol: CloudflareProtocol, retry: Retry.Retry, })); // Alias of bulkDeleteNamespaces (same route, alternate export name upstream). export const bulkDeleteNamespaceKeys = bulkDeleteNamespaces; export type BulkDeleteNamespaceKeysRequest = BulkDeleteNamespacesRequest; export type BulkDeleteNamespaceKeysResponse = BulkDeleteNamespacesResponse; export type BulkDeleteNamespaceKeysError = BulkDeleteNamespacesError; // Alias of bulkGetNamespaces (same route, alternate export name upstream). export const bulkGetNamespaceKeys = bulkGetNamespaces; export type BulkGetNamespaceKeysRequest = BulkGetNamespacesRequest; export type BulkGetNamespaceKeysResponse = BulkGetNamespacesResponse; export type BulkGetNamespaceKeysError = BulkGetNamespacesError; // Alias of bulkPutNamespaces (same route, alternate export name upstream). export const bulkPutNamespaceKeys = bulkPutNamespaces; export type BulkPutNamespaceKeysRequest = BulkPutNamespacesRequest; export type BulkPutNamespaceKeysResponse = BulkPutNamespacesResponse; export type BulkPutNamespaceKeysError = BulkPutNamespacesError;