UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

56 lines (48 loc) • 1.73 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; export class BaseCredentials extends APIResource { static override readonly _key: readonly ['r2DataCatalog', 'credentials'] = Object.freeze([ 'r2DataCatalog', 'credentials', ] as const); /** * Store authentication credentials for a catalog. These credentials are used to * authenticate with R2 storage when performing catalog operations. * * @deprecated Use `POST /accounts/{account_id}/basin-catalog/{bucket_name}/credential` instead. */ create( bucketName: string, params: CredentialCreateParams, options?: RequestOptions, ): APIPromise<CredentialCreateResponse | null> { const { account_id, ...body } = params; return ( this._client.post(path`/accounts/${account_id}/r2-catalog/${bucketName}/credential`, { body, ...options, }) as APIPromise<{ result: CredentialCreateResponse | null }> )._thenUnwrap((obj) => obj.result); } } export class Credentials extends BaseCredentials {} export type CredentialCreateResponse = unknown; export interface CredentialCreateParams { /** * Path param: Identifies the account. */ account_id: string; /** * Body param: Provides the Cloudflare API token for accessing R2. */ token: string; } export declare namespace Credentials { export { type CredentialCreateResponse as CredentialCreateResponse, type CredentialCreateParams as CredentialCreateParams, }; }