@c8y/client
Version:
Client application programming interface to access the Cumulocity IoT-Platform REST services.
43 lines • 2.25 kB
TypeScript
import { Stream } from 'stream';
import { Service, IResult, IFetchResponse, IFetchOptions } from '../core/index.js';
import { IdReference } from './InventoryService.js';
import { IManagedObject, IManagedObjectBinary } from './IManagedObject.js';
export declare class InventoryBinaryService extends Service<IManagedObjectBinary> {
protected baseUrl: string;
protected listUrl: string;
protected propertyName: string;
/**
* Uploads a file and creates a managed object with its metadata.
* @param file A file to be uploaded.
* @param managedObject An object containing metadata about the file.
* Note that you can specify `fileType` and `fileName` in case `file` does not define them
* but these two properties will be removed from `managedObject` before saving.
*/
create(file: Stream | Buffer | File | Blob, managedObject?: Partial<IManagedObject>): Promise<IResult<IManagedObjectBinary>>;
list(filter?: object): Promise<import("../core/IResultList.js").IResultList<IManagedObjectBinary>>;
delete(managedObjectOrId: IdReference): Promise<IResult<null>>;
download(managedObjectOrId: IdReference, init?: IFetchOptions): Promise<IFetchResponse>;
/**
* Uploads a file and creates a managed object with its metadata. What's more, it invokes an upload progress callback.
* @param file A file to be uploaded.
* @param managedObject An object containing metadata about the file.
* @param onProgress Event handler for progress update, invoked while the browser is uploading the file.
*/
createWithProgress(file: Stream | Buffer | File | Blob, onProgress: EventListener, managedObject?: Partial<IManagedObject>): XMLHttpRequest;
getXMLHttpResponse(xhr: any): Promise<IResult<IManagedObjectBinary>>;
/**
* Gets binary managed object's id from its download or self URL.
*
* @param {string} url URL string.
*
* @returns {number} Binary managed object's id.
*
* **Example**
* ```typescript
*
* const id = InventoryBinaryService.getIdFromUrl('http://mytenant.cumulocity.com/inventory/binaries/12345');
* ```
*/
getIdFromUrl(url: string): string;
}
//# sourceMappingURL=InventoryBinaryService.d.ts.map