UNPKG

@mindconnect/mindconnect-nodejs

Version:

NodeJS Library for Siemens Insights Hub Connectivity - TypeScript SDK for Insights Hub and Industrial IoT - Command Line Interface - Insights Hub Development Proxy (Siemens Insights Hub was formerly known as MindSphere)

181 lines (180 loc) 6.7 kB
/// <reference types="node" /> import { SdkClient } from "../common/sdk-client"; import { DataExchangeModels } from "./data-exchange-models"; /** * * Offers data transfer operations as part of the Analytics package, * in a single endpoint providing various operations like upload/download, move, (recursive) delete, * share within tenant.It also provides an abstraction that helps callers easily share files and folders * between the users of tHe same tenant, while allowing uploads with different visibilities private, or * public (within a tenant only) When looking to p[lace a file or directory * (either when creating a new one or moving it) into the root of the storage, * simply set the parentId of the file or folder to one of the "_PUBLIC_ROOT_ID" or "_PRIVATE_ROOT_ID" * allowing in this way to specify its visibility space. * * Allowed and safe characters to use in both filename and directyory names are the following: * Alphanumeric characters [0-9a-zA-Z] * Special characters -, _, ., (, ), and the space character The following are examples of valid object key names: * 4my-data * _test_dir./myfile.csv * Not allowed is using &$@=;:+,?,^{}%`[]"<>#|~!*' in filenames and directory names. mode The maximum length of the composed path, that is filename and directories names separated by '/' that is used in a request is 1024 bytes in UTF-8 encoding. * * * @export * @class DataExchangeClient * @extends {SdkClient} */ export declare class DataExchangeClient extends SdkClient { private _baseUrl; /** * * Files * * Performs a new file upload * * Uploads a file using the specified form data parameters, and returns the created file resource. * The service verifies whether the user or the tenant under which the operation occurs has access * to the specified parent and generates an error in case of an unautorhized access. * * @param {DataExchangeModels.ResourcePatch} metadata * @param {Buffer} file * @returns {Promise<DataExchangeModels.File>} * * @memberOf DataExchangeClient */ PostFile(metadata: DataExchangeModels.ResourcePatch, file: Buffer): Promise<DataExchangeModels.File>; /** * * Files * * Downloads the file identified by the specified ID. * * @param {string} id * @returns {Promise<Response>} * * @memberOf DataExchangeClient */ GetFile(id: string): Promise<Response>; /** * * Files * * Uploads a file on top of an existing file * * @param {string} id * @param {Buffer} file * @returns {Promise<DataExchangeModels.File>} * * @memberOf DataExchangeClient */ PutFile(id: string, file: Buffer): Promise<DataExchangeModels.File>; /** * * Files * * Deletes a file (both metadata and the actual content). * * @param {string} id * * @memberOf DataExchangeClient */ DeleteFile(id: string): Promise<void>; /** * * Retrieves metadata of the file identified by the specified ID. * * @param {string} id * @returns {Promise<DataExchangeModels.File>} * * @memberOf DataExchangeClient */ GetFileProperties(id: string): Promise<DataExchangeModels.File>; /** * * Files * * Allows updating specific properties associated with the file, namely its name and parent (by ID). * Updating the visibility (namely tenant-wide or user-only) for a file is not available but can be achieved * via changing the current file's parent to a directory that has a different visibility space. * * @param {string} id * @param {DataExchangeModels.ResourcePatch} options * @returns {Promise<DataExchangeModels.File>} * * @memberOf DataExchangeClient */ PatchFileProperties(id: string, options: DataExchangeModels.ResourcePatch): Promise<DataExchangeModels.File>; /** * * Directories * * creates a directory * * @param {DataExchangeModels.ResourcePatch} metadata * @returns {Promise<DataExchangeModels.Directory>} * * @memberOf DataExchangeClient */ PostDirectory(metadata: DataExchangeModels.ResourcePatch): Promise<DataExchangeModels.Directory>; /** * * Retreives updatable directory options, i.e the name and the parentId. * * @param {string} id * @returns {Promise<DataExchangeModels.Directory>} * * @memberOf DataExchangeClient */ GetDirectoryProperties(id: string): Promise<DataExchangeModels.Directory>; /** * * Directories * * Allows updating directory's properties. * * Allows updating directory metadata, including the parentId (which triggers a move of the current directory), * or its visibility by moving it under a parentId that has a different visibility, * causing this change to propagate to its inner contents. * Changing the parentId to a parent that already contains a folder with the same name is not possible, * an error will be thrown. * * @param {string} id * @param {DataExchangeModels.ResourcePatch} options * @returns {Promise<DataExchangeModels.Directory>} * * @memberOf DataExchangeClient */ PatchDirectoryProperties(id: string, options: DataExchangeModels.ResourcePatch): Promise<DataExchangeModels.Directory>; /** * * * Directories * * Using GET on this endpoint to get a list of the source's contents * * Specifies the id for which it will list the contents. * By convention, when listing a root folder also implies specifying the visibility * that the caller is looking after, that is, if listing the private space root, then this parameter requires * "_PUBLIC_ROOT_ID" or "_PRIVATE_ROOT_ID" value instead of a real directory id. * * @param {string} id * @param {{ pageNumber?: number; pageSize?: number; filter: string }} params * @returns {Promise<DataExchangeModels.DirectoriesFilesArray>} * * @memberOf DataExchangeClient */ GetDirectory(id: string, params?: { pageNumber?: number; pageSize?: number; filter?: string; }): Promise<DataExchangeModels.DirectoriesFilesArray>; /** * * Directories * * Deletes a directory and its contents if recursive=true * * @param {string} id * @param {{ recursive?: boolean }} [params] * * @param params.recursive specifies if the deletion will be performed recursively * * @memberOf DataExchangeClient */ DeleteDirectory(id: string, params?: { recursive?: boolean; }): Promise<void>; }