@graphistry/js-upload-api
Version:
Graphistry upload client for reuse by node and browser clients
111 lines • 3.2 kB
TypeScript
import { ClientType } from './types.js';
/**
* # Kind
*
* The kind of item to set privacy on, defaults to 'dataset'
*
*/
export declare type Kind = 'dataset';
/**
* # Mode
*
* The privacy mode, 'private', 'public', or 'organization'
*
*/
export declare type Mode = 'private' | 'public' | 'organization';
/**
*
* @internal
*
*/
export declare type ModeActionRaw = '10' | '20' | '30';
/**
* # ModeActionFriendly
*
* The action to allow, 'view', 'edit', or 'share'
*
*/
export declare type ModeAction = 'view' | 'edit' | 'share';
/**
* # Privacy examples
*
* {@link Privacy} is used to set the privacy mode of an item. By default, items are public,
* meaning world-readable but not listed in any public Graphistry catalogs.
*
* Setting the privacy, by default, makes it private to the user. No notifications are made.
*
* Various options allow sharing with the organization, sharing with specific users,
* and sending notifications. When sharing with others, view or edit permissions may be given.
*
* See all convenience method {@link Dataset.privacy}
*
* <br>
*
* ---
*
* <br>
*
* @example **Set a dataset to private**
* ```javascript
* import { Privacy } from '@graphistry/node-api';
* await (new Privacy('myDatasetID')).upload(client);
* ```
*
* <br>
*
* @example **Set a dataset to public**
* ```javascript
* import { Privacy } from '@graphistry/node-api';
* await (new Privacy('myDatasetID', 'public')).upload(client);
* ```
*
* <br>
*
* @example **Set a dataset to private, and share it with one user with a notification**
* ```javascript
* import { Privacy } from '@graphistry/node-api';
* await (new Privacy(
* 'myDatasetID', undefined, undefined, undefined,
* ['friend@company.com'], true, "Check out my great viz!"
* )).upload(client);
* ```
*
*/
export declare class Privacy {
id: string;
kind: Kind;
modeAction: ModeActionRaw;
invitedUsers: string[];
mode: Mode;
notify: boolean;
message: string;
/**
*
* See examples at top of file
*
* Create sharing configuration in preperation for uploading.
*
* @param id The id of the item to set privacy on
* @param kind The kind of item to set privacy on, defaults to 'dataset'
* @param mode The privacy mode, 'private', 'public', or 'organization'
* @param modeAction The action to allow, 'view', 'edit', or 'share'
* @param invitedUsers The list of Graphistry user emails to share with
* @param notify Whether to send notifications to the invited users
* @param message The message to send to the invited users
**/
constructor(id: string, kind?: Kind, mode?: Mode, modeAction?: ModeAction, invitedUsers?: string[], notify?: boolean, message?: string);
/**
*
* See examples at top of file
*
* Upload the privacy configuration to the server for an item
*
* @param client The client to use to upload the privacy
* @returns The privacy object
* @throws Error if the client is not configured
* @throws Error if the upload fails
*
*/
upload(client: ClientType): Promise<Privacy>;
}
//# sourceMappingURL=Privacy.d.ts.map