using System.Collections.Generic; using System.IO; namespace AppLimit.CloudComputing.SharpBox.StorageProvider.API { /// /// This interface is part of the sharpbox extensability api /// and has to be implemented as main entry point for an /// existing service /// public interface IStorageProviderService { /// /// Checks if the given token are valid for using with this /// service /// /// /// /// bool VerifyAccessTokenType(ICloudStorageAccessToken token); /// /// establishing a new session via access token /// /// /// /// IStorageProviderSession CreateSession(ICloudStorageAccessToken token, ICloudStorageConfiguration configuration); /// /// This method closes a created session /// /// void CloseSession(IStorageProviderSession session); CloudStorageLimits GetLimits(IStorageProviderSession session); /// /// Requests all resource information via webcall /// /// /// /// /// ICloudFileSystemEntry RequestResource(IStorageProviderSession session, string name, ICloudDirectoryEntry parent); /// /// This method refreshes the metadata of an resource /// /// /// void RefreshResource(IStorageProviderSession session, ICloudFileSystemEntry resource); /// /// Creates or updates a resource via webcall /// /// /// /// /// ICloudFileSystemEntry CreateResource(IStorageProviderSession session, string name, ICloudDirectoryEntry parent); /// /// Removes a specific resource from the web location /// /// /// bool DeleteResource(IStorageProviderSession session, ICloudFileSystemEntry entry); /// /// Moves a give resource from one location to an other /// /// /// /// /// bool MoveResource(IStorageProviderSession session, ICloudFileSystemEntry fsentry, ICloudDirectoryEntry newParent); /// /// Copy a give resource from one location to an other /// /// /// /// /// bool CopyResource(IStorageProviderSession session, ICloudFileSystemEntry fsentry, ICloudDirectoryEntry newParent); /// /// Renames a give resource /// /// /// /// /// bool RenameResource(IStorageProviderSession session, ICloudFileSystemEntry fsentry, string newName); /// /// Receives the information which are stored in a token /// /// /// /// void StoreToken(IStorageProviderSession session, Dictionary tokendata, ICloudStorageAccessToken token); /// /// Loads the information from a token stream /// ICloudStorageAccessToken LoadToken(Dictionary tokendata); /// /// The method returns the url to a specific resource /// /// /// /// /// string GetResourceUrl(IStorageProviderSession session, ICloudFileSystemEntry fileSystemEntry, string additionalPath); /// /// This interface implements the download code /// /// /// /// /// /// void DownloadResourceContent(IStorageProviderSession session, ICloudFileSystemEntry fileSystemEntry, Stream targetDataStream, FileOperationProgressChanged progressCallback, object progressContext); /// /// Allows the access to the download stream directly /// /// /// /// Stream CreateDownloadStream(IStorageProviderSession session, ICloudFileSystemEntry fileSystemEntry); /// /// This method is called when the stream operation is finished but before the /// dispose method of the stream will be called /// /// /// /// /// void CommitStreamOperation(IStorageProviderSession session, ICloudFileSystemEntry fileSystemEntry, nTransferDirection direction, Stream notDisposedStream); /// /// This interface implements the upload code /// /// /// /// /// /// void UploadResourceContent(IStorageProviderSession session, ICloudFileSystemEntry fileSystemEntry, Stream targetDataStream, FileOperationProgressChanged progressCallback, object progressContext); /// /// Allows the access to the upload stream directly /// /// /// /// /// Stream CreateUploadStream(IStorageProviderSession session, ICloudFileSystemEntry fileSystemEntry, long uploadSize); bool SupportsDirectRetrieve { get; } bool SupportsChunking { get; } IResumableUploadSession CreateUploadSession(IStorageProviderSession session, ICloudFileSystemEntry fileSystemEntry, long bytesToTransfer); void AbortUploadSession(IStorageProviderSession session, IResumableUploadSession uploadSession); void UploadChunk(IStorageProviderSession session, IResumableUploadSession uploadSession, Stream stream, long chunkLength); } }