export type BucketOwnerUpdateRequest = {id: number | null, email?: (string | null) | undefined} | {id?: (number | null) | undefined, email: string | null}; export type CreateApiV2StorageBranchBranchIdBucketsBucketIdOwnerArgs = {bucketId: string, branchId: string, body: BucketOwnerUpdateRequest}; export type CreateApiV2StorageBranchBranchIdBucketsBucketIdOwnerOptions = {baseUrl?: string | undefined, StorageKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Bucket Owner update * * POST /v2/storage/branch/{branchId}/buckets/{bucketId}/owner * * Also accepts auth: ManageKey, BearerAuth */ export const createApiV2StorageBranchBranchIdBucketsBucketIdOwner = async (args: CreateApiV2StorageBranchBranchIdBucketsBucketIdOwnerArgs, options?: CreateApiV2StorageBranchBranchIdBucketsBucketIdOwnerOptions) => { const {baseUrl = "https://connection.keboola.com", fetch: fetchFn = fetch, StorageKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (StorageKey !== undefined) headers.set("X-StorageApi-Token", StorageKey) const url = `${baseUrl.replace(/\/+$/, '')}/v2/storage/branch/${encodeURIComponent(String(args.branchId))}/buckets/${encodeURIComponent(String(args.bucketId))}/owner${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };