/**
 * Cloudflare DURABLE-OBJECTS API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service durable-objects
 */
import * as Schema from "effect/Schema";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import {} from "../errors.js";
// =============================================================================
// Errors
// =============================================================================
export class InvalidIdentifier extends Schema.TaggedErrorClass()("InvalidIdentifier", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidIdentifier, [{ code: 7003 }]);
export class MalformedParameter extends Schema.TaggedErrorClass()("MalformedParameter", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(MalformedParameter, [{ code: 10077 }]);
export class NamespaceNotFound extends Schema.TaggedErrorClass()("NamespaceNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(NamespaceNotFound, [{ code: 10066 }]);
export const ListNamespacesRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    page: Schema.optional(Schema.Number).pipe(T.HttpQuery("page")),
    perPage: Schema.optional(Schema.Number).pipe(T.HttpQuery("per_page")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/workers/durable_objects/namespaces",
}));
export const ListNamespacesResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        class: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        script: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        useSqlite: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        class: "class",
        name: "name",
        script: "script",
        useSqlite: "use_sqlite",
    }))),
    resultInfo: Schema.optional(Schema.Union([
        Schema.Struct({
            count: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            page: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            perPage: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            totalCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            count: "count",
            page: "page",
            perPage: "per_page",
            totalCount: "total_count",
        })),
        Schema.Null,
    ])),
}).pipe(Schema.encodeKeys({ result: "result", resultInfo: "result_info" }));
export const listNamespaces = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListNamespacesRequest,
    output: ListNamespacesResponse,
    errors: [InvalidIdentifier],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const ListNamespaceObjectsRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String.pipe(T.HttpPath("id")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    cursor: Schema.optional(Schema.String).pipe(T.HttpQuery("cursor")),
    limit: Schema.optional(Schema.Number).pipe(T.HttpQuery("limit")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/workers/durable_objects/namespaces/{id}/objects",
}));
export const ListNamespaceObjectsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        hasStoredData: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    })),
    resultInfo: Schema.optional(Schema.Union([
        Schema.Struct({
            cursors: Schema.optional(Schema.Union([
                Schema.Struct({
                    after: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                }),
                Schema.Null,
            ])),
        }),
        Schema.Null,
    ])),
}).pipe(Schema.encodeKeys({ result: "result", resultInfo: "result_info" }));
export const listNamespaceObjects = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListNamespaceObjectsRequest,
    output: ListNamespaceObjectsResponse,
    errors: [NamespaceNotFound, InvalidIdentifier, MalformedParameter],
    pagination: {
        mode: "cursor",
        inputToken: "cursor",
        outputToken: "resultInfo.cursors.after",
        items: "result",
    },
}));
//# sourceMappingURL=durable-objects.js.map