Skip to main content

Public & Private Access

Change object visibility with makePublic and makePrivate. Both methods return a short summary of the object after the change.

Function signatures

client.storage.makePublic(
filePath: string
): Promise<ObjectAccessSummary | BolticErrorResponse>;

client.storage.makePrivate(filePath: string): Promise<ObjectAccessSummary | BolticErrorResponse>;

Parameters

MethodArgumentDescription
makePublicfilePathFull object path in the bucket
makePrivatefilePathFull object path in the bucket

Return Value — ObjectAccessSummary

FieldDescription
messageStatus text from the API
nameFull path of the object
sizeSize string (or null)
updatedLast update string (or null)
publictrue if public, false if private

Make an object public

import { createClient, isErrorResponse } from "@boltic/sdk";

const client = createClient("your-api-key");

const result = await client.storage.makePublic("my-app/docs/readme.pdf");

if (isErrorResponse(result)) {
console.error(result.error.message);
} else {
console.log(result.public, result.name, result.size);
}

Make an object private

const result = await client.storage.makePrivate("my-app/public/old-banner.png");

if (!isErrorResponse(result)) {
console.log("Now private:", result.public === false);
}

Behavior

If the visibility change succeeds but the summary cannot be loaded, you may still receive an error. Retry list on the parent prefix to confirm the object state.