Privacy
This section covers the methods to handle with the spreadsheet privacy.
Documentation
Section titled “Documentation”Methods
Section titled “Methods”The following methods are available to interact with the spreadsheet privacy programmatically.
| Method | Description |
|---|---|
| getPrivacy | Get spreadsheet privacy. Jspreadsheet getPrivacy(): Promise<privacyEnum>; GET /api/:guid/privacy |
| setPrivacy | Change spreadsheet privacy. Jspreadsheet setPrivacy(privacy: privacyEnum): Promise<void> @param privacy - privacy number. POST /api/:guid/privacy |
Examples
Section titled “Examples”Get Privacy
Section titled “Get Privacy”import { Client } from "@intrasheets/client";
// Create a new clientconst client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",});
// Spreadsheet Guidconst guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
spreadsheet.getPrivacy().then((privacy) => { console.log(privacy);});Set Privacy
Section titled “Set Privacy”import { Client, privacyEnum } from "@intrasheets/client";
// Create a new clientconst client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",});
// Spreadsheet Guidconst guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
spreadsheet.setPrivacy(privacyEnum.Private).then(() => { console.log("Privacy changed");});