// File generated from our OpenAPI spec by Stainless.
import { APIResource } from 'cloudflare/resource';
import * as DatabaseAPI from 'cloudflare/resources/d1/database';
import { V4PagePaginationArray } from 'cloudflare/pagination';
export class Database extends APIResource {
    /**
     * Returns the created D1 database.
     */
    create(params, options) {
        const { account_id, ...body } = params;
        return this._client.post(`/accounts/${account_id}/d1/database`, { body, ...options })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Returns a list of D1 databases.
     */
    list(params, options) {
        const { account_id, ...query } = params;
        return this._client.getAPIList(`/accounts/${account_id}/d1/database`, D1CreateDatabasesV4PagePaginationArray, { query, ...options });
    }
    /**
     * Deletes the specified D1 database.
     */
    delete(accountIdentifier, databaseIdentifier, options) {
        return this._client.delete(`/accounts/${accountIdentifier}/d1/database/${databaseIdentifier}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Returns the specified D1 database.
     */
    get(accountIdentifier, databaseIdentifier, options) {
        return this._client.get(`/accounts/${accountIdentifier}/d1/database/${databaseIdentifier}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Returns the query result.
     */
    query(accountIdentifier, databaseIdentifier, body, options) {
        return this._client.post(`/accounts/${accountIdentifier}/d1/database/${databaseIdentifier}/query`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
}
export class D1CreateDatabasesV4PagePaginationArray extends V4PagePaginationArray {
}
(function (Database) {
    Database.D1CreateDatabasesV4PagePaginationArray = DatabaseAPI.D1CreateDatabasesV4PagePaginationArray;
})(Database || (Database = {}));
//# sourceMappingURL=database.mjs.map