@fleekhq/space-client
Advanced tools
Comparing version 1.1.3 to 1.1.4
import grpcWeb, { ClientReadableStream } from 'grpc-web'; | ||
import { SpaceApiClient } from './definitions/SpaceServiceClientPb'; | ||
import { OpenFilePayload, CreateBucketPayload, AddItemsPayload, CreateFolderPayload, BackupKeysByPassphrasePayload, RecoverKeysByPassphrasePayload, ToggleFusePayload, GetFuseDriveStatusPayload, ListDirectoriesPayload, ListDirectoryPayload, ToggleBucketBackupPayload, ShareBucketPayload, JoinBucketPayload, ReadNotificationPayload, GetNotificationsPayload, RestoreKeyPairViaMnemonicPayload, GetSharedWithMeFilesPayload, ShareFilesViaPublicKeyPayload, GeneratePublicFileLinkPayload, TestKeysPassphrasePayload, SetNotificationsLastSeenAtPayload, HandleFilesInvitationPayload, OpenPublicFilePayload, SearchFilesPayload } from './types'; | ||
import { TextileEventResponse, ListDirectoriesResponse, ToggleBucketBackupResponse, OpenFileResponse, CreateBucketResponse, AddItemsResponse, CreateFolderResponse, BackupKeysByPassphraseResponse, RecoverKeysByPassphraseResponse, FuseDriveResponse, FileEventResponse, ListBucketsResponse, ListDirectoryResponse, ShareBucketResponse, JoinBucketResponse, GetPublicKeyResponse, NotificationEventResponse, ReadNotificationResponse, GetNotificationsResponse, HandleFilesInvitationResponse, DeleteKeyPairResponse, GetUsageInfoResponse, GetStoredMnemonicResponse, RestoreKeyPairViaMnemonicResponse, GetSharedWithMeFilesResponse, ShareFilesViaPublicKeyResponse, GetAPISessionTokensResponse, GetRecentlySharedWithResponse, GeneratePublicFileLinkResponse, TestKeysPassphraseResponse, SetNotificationsLastSeenAtResponse, GenerateKeyPairResponse, OpenPublicFileResponse, SearchFilesResponse } from './definitions/space_pb'; | ||
import { OpenFilePayload, CreateBucketPayload, AddItemsPayload, CreateFolderPayload, BackupKeysByPassphrasePayload, RecoverKeysByPassphrasePayload, ToggleFusePayload, GetFuseDriveStatusPayload, ListDirectoriesPayload, ListDirectoryPayload, ToggleBucketBackupPayload, ShareBucketPayload, JoinBucketPayload, ReadNotificationPayload, GetNotificationsPayload, RestoreKeyPairViaMnemonicPayload, GetSharedWithMeFilesPayload, ShareFilesViaPublicKeyPayload, GeneratePublicFileLinkPayload, TestKeysPassphrasePayload, SetNotificationsLastSeenAtPayload, HandleFilesInvitationPayload, OpenPublicFilePayload, SearchFilesPayload, GetSharedByMeFilesPayload } from './types'; | ||
import { TextileEventResponse, ListDirectoriesResponse, ToggleBucketBackupResponse, OpenFileResponse, CreateBucketResponse, AddItemsResponse, CreateFolderResponse, BackupKeysByPassphraseResponse, RecoverKeysByPassphraseResponse, FuseDriveResponse, FileEventResponse, ListBucketsResponse, ListDirectoryResponse, ShareBucketResponse, JoinBucketResponse, GetPublicKeyResponse, NotificationEventResponse, ReadNotificationResponse, GetNotificationsResponse, HandleFilesInvitationResponse, DeleteKeyPairResponse, GetUsageInfoResponse, GetStoredMnemonicResponse, RestoreKeyPairViaMnemonicResponse, GetSharedWithMeFilesResponse, ShareFilesViaPublicKeyResponse, GetAPISessionTokensResponse, GetRecentlySharedWithResponse, GeneratePublicFileLinkResponse, TestKeysPassphraseResponse, SetNotificationsLastSeenAtResponse, GenerateKeyPairResponse, OpenPublicFileResponse, SearchFilesResponse, GetSharedByMeFilesResponse } from './definitions/space_pb'; | ||
export interface SpaceClientOpts { | ||
@@ -66,3 +66,4 @@ url: string; | ||
searchFiles(payload: SearchFilesPayload, metadata?: grpcWeb.Metadata): Promise<SearchFilesResponse>; | ||
getSharedByMeFiles(payload: GetSharedByMeFilesPayload, metadata?: grpcWeb.Metadata): Promise<GetSharedByMeFilesResponse>; | ||
} | ||
export default SpaceClient; |
@@ -504,4 +504,18 @@ "use strict"; | ||
} | ||
getSharedByMeFiles(payload, metadata = {}) { | ||
return new Promise((resolve, reject) => { | ||
const request = new space_pb_1.GetSharedByMeFilesRequest(); | ||
request.setSeek(payload.seek); | ||
request.setLimit(payload.limit); | ||
this.instance.getSharedByMeFiles(request, metadata, (err, res) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
resolve(res); | ||
}); | ||
}); | ||
} | ||
} | ||
exports.default = SpaceClient; | ||
//# sourceMappingURL=client.js.map |
@@ -60,2 +60,5 @@ /** | ||
getSharedWithMeFiles(request: space_pb.GetSharedWithMeFilesRequest, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.Error, response: space_pb.GetSharedWithMeFilesResponse) => void): grpcWeb.ClientReadableStream<space_pb.GetSharedWithMeFilesResponse>; | ||
methodInfoGetSharedByMeFiles: grpcWeb.AbstractClientBase.MethodInfo<space_pb.GetSharedByMeFilesRequest, space_pb.GetSharedByMeFilesResponse>; | ||
getSharedByMeFiles(request: space_pb.GetSharedByMeFilesRequest, metadata: grpcWeb.Metadata | null): Promise<space_pb.GetSharedByMeFilesResponse>; | ||
getSharedByMeFiles(request: space_pb.GetSharedByMeFilesRequest, metadata: grpcWeb.Metadata | null, callback: (err: grpcWeb.Error, response: space_pb.GetSharedByMeFilesResponse) => void): grpcWeb.ClientReadableStream<space_pb.GetSharedByMeFilesResponse>; | ||
methodInfoOpenPublicFile: grpcWeb.AbstractClientBase.MethodInfo<space_pb.OpenPublicFileRequest, space_pb.OpenPublicFileResponse>; | ||
@@ -62,0 +65,0 @@ openPublicFile(request: space_pb.OpenPublicFileRequest, metadata: grpcWeb.Metadata | null): Promise<space_pb.OpenPublicFileResponse>; |
@@ -74,2 +74,5 @@ "use strict"; | ||
}, space_pb.GetSharedWithMeFilesResponse.deserializeBinary); | ||
this.methodInfoGetSharedByMeFiles = new grpcWeb.AbstractClientBase.MethodInfo(space_pb.GetSharedByMeFilesResponse, (request) => { | ||
return request.serializeBinary(); | ||
}, space_pb.GetSharedByMeFilesResponse.deserializeBinary); | ||
this.methodInfoOpenPublicFile = new grpcWeb.AbstractClientBase.MethodInfo(space_pb.OpenPublicFileResponse, (request) => { | ||
@@ -262,2 +265,10 @@ return request.serializeBinary(); | ||
} | ||
getSharedByMeFiles(request, metadata, callback) { | ||
if (callback !== undefined) { | ||
return this.client_.rpcCall(this.hostname_ + | ||
'/space.SpaceApi/GetSharedByMeFiles', request, metadata || {}, this.methodInfoGetSharedByMeFiles, callback); | ||
} | ||
return this.client_.unaryCall(this.hostname_ + | ||
'/space.SpaceApi/GetSharedByMeFiles', request, metadata || {}, this.methodInfoGetSharedByMeFiles); | ||
} | ||
openPublicFile(request, metadata, callback) { | ||
@@ -264,0 +275,0 @@ if (callback !== undefined) { |
import { Empty } from 'google-protobuf/google/protobuf/empty_pb'; | ||
import { SpaceApiClient } from './definitions/SpaceServiceClientPb'; | ||
import { ListDirectoriesRequest, ToggleBucketBackupRequest, OpenFileRequest, CreateBucketRequest, AddItemsRequest, CreateFolderRequest, BackupKeysByPassphraseRequest, RecoverKeysByPassphraseRequest, ToggleFuseRequest, ListBucketsRequest, ListDirectoryRequest, ShareBucketRequest, JoinBucketRequest, ThreadInfo, GetPublicKeyRequest, ReadNotificationRequest, GetNotificationsRequest, HandleFilesInvitationRequest, DeleteKeyPairRequest, DeleteAccountRequest, GetUsageInfoRequest, GetStoredMnemonicRequest, RestoreKeyPairViaMnemonicRequest, GetSharedWithMeFilesRequest, ShareFilesViaPublicKeyRequest, GetAPISessionTokensRequest, GetRecentlySharedWithRequest, GeneratePublicFileLinkRequest, TestKeysPassphraseRequest, SetNotificationsLastSeenAtRequest, GenerateKeyPairRequest, FullPath, OpenPublicFileRequest, SearchFilesRequest, } from './definitions/space_pb'; | ||
import { ListDirectoriesRequest, ToggleBucketBackupRequest, OpenFileRequest, CreateBucketRequest, AddItemsRequest, CreateFolderRequest, BackupKeysByPassphraseRequest, RecoverKeysByPassphraseRequest, ToggleFuseRequest, ListBucketsRequest, ListDirectoryRequest, ShareBucketRequest, JoinBucketRequest, ThreadInfo, GetPublicKeyRequest, ReadNotificationRequest, GetNotificationsRequest, HandleFilesInvitationRequest, DeleteKeyPairRequest, DeleteAccountRequest, GetUsageInfoRequest, GetStoredMnemonicRequest, RestoreKeyPairViaMnemonicRequest, GetSharedWithMeFilesRequest, ShareFilesViaPublicKeyRequest, GetAPISessionTokensRequest, GetRecentlySharedWithRequest, GeneratePublicFileLinkRequest, TestKeysPassphraseRequest, SetNotificationsLastSeenAtRequest, GenerateKeyPairRequest, FullPath, OpenPublicFileRequest, SearchFilesRequest, GetSharedByMeFilesRequest, } from './definitions/space_pb'; | ||
var DEFAULT_BUCKET = 'personal'; | ||
@@ -571,2 +571,18 @@ var SpaceClient = /** @class */ (function () { | ||
}; | ||
SpaceClient.prototype.getSharedByMeFiles = function (payload, metadata) { | ||
var _this = this; | ||
if (metadata === void 0) { metadata = {}; } | ||
return new Promise(function (resolve, reject) { | ||
var request = new GetSharedByMeFilesRequest(); | ||
request.setSeek(payload.seek); | ||
request.setLimit(payload.limit); | ||
_this.instance.getSharedByMeFiles(request, metadata, function (err, res) { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
resolve(res); | ||
}); | ||
}); | ||
}; | ||
return SpaceClient; | ||
@@ -573,0 +589,0 @@ }()); |
@@ -52,2 +52,5 @@ /** | ||
}, space_pb.GetSharedWithMeFilesResponse.deserializeBinary); | ||
this.methodInfoGetSharedByMeFiles = new grpcWeb.AbstractClientBase.MethodInfo(space_pb.GetSharedByMeFilesResponse, function (request) { | ||
return request.serializeBinary(); | ||
}, space_pb.GetSharedByMeFilesResponse.deserializeBinary); | ||
this.methodInfoOpenPublicFile = new grpcWeb.AbstractClientBase.MethodInfo(space_pb.OpenPublicFileResponse, function (request) { | ||
@@ -240,2 +243,10 @@ return request.serializeBinary(); | ||
}; | ||
SpaceApiClient.prototype.getSharedByMeFiles = function (request, metadata, callback) { | ||
if (callback !== undefined) { | ||
return this.client_.rpcCall(this.hostname_ + | ||
'/space.SpaceApi/GetSharedByMeFiles', request, metadata || {}, this.methodInfoGetSharedByMeFiles, callback); | ||
} | ||
return this.client_.unaryCall(this.hostname_ + | ||
'/space.SpaceApi/GetSharedByMeFiles', request, metadata || {}, this.methodInfoGetSharedByMeFiles); | ||
}; | ||
SpaceApiClient.prototype.openPublicFile = function (request, metadata, callback) { | ||
@@ -242,0 +253,0 @@ if (callback !== undefined) { |
@@ -100,1 +100,5 @@ export interface ListDirectoryPayload { | ||
} | ||
export interface GetSharedByMeFilesPayload { | ||
seek: string; | ||
limit: number; | ||
} |
{ | ||
"name": "@fleekhq/space-client", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/esm/index.js", |
110
README.md
@@ -1272,2 +1272,112 @@ ![Publish Action Status](https://github.com/FleekHQ/space-client/workflows/Publish/badge.svg?branch=master) | ||
#### .getSharedWithMeFiles({ seek: string, limit: number }) | ||
Returns the list of files shared with me | ||
```js | ||
client | ||
.getSharedWithMeFiles({ | ||
seek: "seek_value", | ||
limit: 30, | ||
}) | ||
.then((res) => { | ||
const result = { | ||
nextOffset: result.getNextoffset(), | ||
items: result.getItemsList().map((item) => { | ||
const entry = item.getEntry(); | ||
return { | ||
dbId: item.getDbid(), | ||
bucket: item.getBucket(), | ||
path: entry.getEntrygetPath(), | ||
isDir: entry.getIsdir(), | ||
name: entry.getName(), | ||
sizeInBytes: entry.getSizeinbytes(), | ||
created: entry.getCreated(), | ||
updated: entry.getUpdated(), | ||
fileExtension: entry.getFileextension(), | ||
ipfsHash: entry.getIpfshash(), | ||
isLocallyAvailable: entry.getIslocallyavailable(), | ||
backupCount: entry.getBackupcount(), | ||
members: entry.getMembersList().map((member) => ({ | ||
publicKey: member.getPublickey(), | ||
})), | ||
}; | ||
}), | ||
}; | ||
console.log(result); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
}); | ||
/* Or using Async/Await */ | ||
const asyncFunc = async () => { | ||
const res = await client.getSharedWithMeFiles({ | ||
seek: "seek_value", | ||
limit: 30, | ||
}); | ||
console.log(res.getItemsList()); | ||
... | ||
}; | ||
``` | ||
#### .getSharedByMeFiles({ seek: string, limit: number }) | ||
Returns the list of files shared by me | ||
```js | ||
client | ||
.getSharedByMeFiles({ | ||
seek: "seek_value", | ||
limit: 30, | ||
}) | ||
.then((res) => { | ||
const result = { | ||
nextOffset: result.getNextoffset(), | ||
items: result.getItemsList().map((item) => { | ||
const entry = item.getEntry(); | ||
return { | ||
dbId: item.getDbid(), | ||
bucket: item.getBucket(), | ||
path: entry.getEntrygetPath(), | ||
isDir: entry.getIsdir(), | ||
name: entry.getName(), | ||
sizeInBytes: entry.getSizeinbytes(), | ||
created: entry.getCreated(), | ||
updated: entry.getUpdated(), | ||
fileExtension: entry.getFileextension(), | ||
ipfsHash: entry.getIpfshash(), | ||
isLocallyAvailable: entry.getIslocallyavailable(), | ||
backupCount: entry.getBackupcount(), | ||
members: entry.getMembersList().map((member) => ({ | ||
publicKey: member.getPublickey(), | ||
})), | ||
}; | ||
}), | ||
}; | ||
console.log(result); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
}); | ||
/* Or using Async/Await */ | ||
const asyncFunc = async () => { | ||
const res = await client.getSharedByMeFiles({ | ||
seek: "seek_value", | ||
limit: 30, | ||
}); | ||
console.log(res.getItemsList()); | ||
... | ||
}; | ||
``` | ||
## Example | ||
@@ -1274,0 +1384,0 @@ You can check the example included in the `example` folder. |
@@ -30,2 +30,3 @@ import grpcWeb, { ClientReadableStream } from 'grpc-web'; | ||
SearchFilesPayload, | ||
GetSharedByMeFilesPayload, | ||
} from './types'; | ||
@@ -103,2 +104,4 @@ | ||
SearchFilesResponse, | ||
GetSharedByMeFilesRequest, | ||
GetSharedByMeFilesResponse, | ||
} from './definitions/space_pb'; | ||
@@ -971,4 +974,29 @@ | ||
} | ||
getSharedByMeFiles( | ||
payload: GetSharedByMeFilesPayload, | ||
metadata: grpcWeb.Metadata = {}, | ||
): Promise<GetSharedByMeFilesResponse> { | ||
return new Promise((resolve, reject) => { | ||
const request = new GetSharedByMeFilesRequest(); | ||
request.setSeek(payload.seek); | ||
request.setLimit(payload.limit); | ||
this.instance.getSharedByMeFiles( | ||
request, | ||
metadata, | ||
(err: grpcWeb.Error, res: GetSharedByMeFilesResponse) => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
resolve(res); | ||
}, | ||
); | ||
}); | ||
} | ||
} | ||
export default SpaceClient; |
@@ -517,2 +517,42 @@ /** | ||
methodInfoGetSharedByMeFiles = new grpcWeb.AbstractClientBase.MethodInfo( | ||
space_pb.GetSharedByMeFilesResponse, | ||
(request: space_pb.GetSharedByMeFilesRequest) => { | ||
return request.serializeBinary(); | ||
}, | ||
space_pb.GetSharedByMeFilesResponse.deserializeBinary | ||
); | ||
getSharedByMeFiles( | ||
request: space_pb.GetSharedByMeFilesRequest, | ||
metadata: grpcWeb.Metadata | null): Promise<space_pb.GetSharedByMeFilesResponse>; | ||
getSharedByMeFiles( | ||
request: space_pb.GetSharedByMeFilesRequest, | ||
metadata: grpcWeb.Metadata | null, | ||
callback: (err: grpcWeb.Error, | ||
response: space_pb.GetSharedByMeFilesResponse) => void): grpcWeb.ClientReadableStream<space_pb.GetSharedByMeFilesResponse>; | ||
getSharedByMeFiles( | ||
request: space_pb.GetSharedByMeFilesRequest, | ||
metadata: grpcWeb.Metadata | null, | ||
callback?: (err: grpcWeb.Error, | ||
response: space_pb.GetSharedByMeFilesResponse) => void) { | ||
if (callback !== undefined) { | ||
return this.client_.rpcCall( | ||
this.hostname_ + | ||
'/space.SpaceApi/GetSharedByMeFiles', | ||
request, | ||
metadata || {}, | ||
this.methodInfoGetSharedByMeFiles, | ||
callback); | ||
} | ||
return this.client_.unaryCall( | ||
this.hostname_ + | ||
'/space.SpaceApi/GetSharedByMeFiles', | ||
request, | ||
metadata || {}, | ||
this.methodInfoGetSharedByMeFiles); | ||
} | ||
methodInfoOpenPublicFile = new grpcWeb.AbstractClientBase.MethodInfo( | ||
@@ -519,0 +559,0 @@ space_pb.OpenPublicFileResponse, |
@@ -128,1 +128,6 @@ export interface ListDirectoryPayload { | ||
} | ||
export interface GetSharedByMeFilesPayload { | ||
seek: string; | ||
limit: number; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2618573
49061
1403