@internxt/sdk 1.5.25 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/auth/index.d.ts +127 -122
  2. package/dist/auth/index.js +378 -310
  3. package/dist/auth/types.d.ts +65 -54
  4. package/dist/auth/types.js +26 -26
  5. package/dist/drive/backups/index.d.ts +18 -18
  6. package/dist/drive/backups/index.js +40 -40
  7. package/dist/drive/backups/types.d.ts +27 -27
  8. package/dist/drive/backups/types.js +2 -2
  9. package/dist/drive/index.d.ts +7 -7
  10. package/dist/drive/index.js +23 -19
  11. package/dist/drive/payments/index.d.ts +66 -71
  12. package/dist/drive/payments/index.js +206 -208
  13. package/dist/drive/payments/types.d.ts +180 -176
  14. package/dist/drive/payments/types.js +37 -37
  15. package/dist/drive/referrals/index.d.ts +19 -19
  16. package/dist/drive/referrals/index.js +54 -50
  17. package/dist/drive/referrals/types.d.ts +21 -21
  18. package/dist/drive/referrals/types.js +18 -18
  19. package/dist/drive/share/index.d.ts +319 -319
  20. package/dist/drive/share/index.js +544 -540
  21. package/dist/drive/share/types.d.ts +360 -360
  22. package/dist/drive/share/types.js +2 -2
  23. package/dist/drive/storage/index.d.ts +315 -315
  24. package/dist/drive/storage/index.js +634 -630
  25. package/dist/drive/storage/types.d.ts +480 -473
  26. package/dist/drive/storage/types.js +13 -13
  27. package/dist/drive/trash/index.d.ts +75 -75
  28. package/dist/drive/trash/index.js +184 -180
  29. package/dist/drive/trash/types.d.ts +29 -29
  30. package/dist/drive/trash/types.js +2 -2
  31. package/dist/drive/users/index.d.ts +135 -135
  32. package/dist/drive/users/index.js +208 -204
  33. package/dist/drive/users/types.d.ts +53 -51
  34. package/dist/drive/users/types.js +2 -2
  35. package/dist/index.d.ts +6 -6
  36. package/dist/index.js +35 -31
  37. package/dist/network/download.d.ts +8 -8
  38. package/dist/network/download.js +123 -123
  39. package/dist/network/errors/codes.d.ts +24 -24
  40. package/dist/network/errors/codes.js +48 -48
  41. package/dist/network/errors/context.d.ts +35 -35
  42. package/dist/network/errors/context.js +39 -39
  43. package/dist/network/errors/download.d.ts +4 -4
  44. package/dist/network/errors/download.js +52 -48
  45. package/dist/network/errors/index.d.ts +3 -3
  46. package/dist/network/errors/index.js +19 -15
  47. package/dist/network/errors/upload.d.ts +13 -13
  48. package/dist/network/errors/upload.js +82 -78
  49. package/dist/network/index.d.ts +70 -70
  50. package/dist/network/index.js +315 -311
  51. package/dist/network/types.d.ts +102 -102
  52. package/dist/network/types.js +18 -18
  53. package/dist/network/upload.d.ts +4 -4
  54. package/dist/network/upload.js +158 -159
  55. package/dist/photos/devices/index.d.ts +10 -10
  56. package/dist/photos/devices/index.js +79 -79
  57. package/dist/photos/index.d.ts +17 -17
  58. package/dist/photos/index.js +56 -52
  59. package/dist/photos/photos/index.d.ts +60 -60
  60. package/dist/photos/photos/index.js +225 -225
  61. package/dist/photos/shares/index.d.ts +8 -8
  62. package/dist/photos/shares/index.js +34 -34
  63. package/dist/photos/types.d.ts +154 -154
  64. package/dist/photos/types.js +19 -19
  65. package/dist/photos/users/index.d.ts +7 -7
  66. package/dist/photos/users/index.js +46 -46
  67. package/dist/shared/headers/index.d.ts +21 -21
  68. package/dist/shared/headers/index.js +78 -79
  69. package/dist/shared/http/client.d.ts +85 -85
  70. package/dist/shared/http/client.js +172 -172
  71. package/dist/shared/http/types.d.ts +7 -7
  72. package/dist/shared/http/types.js +2 -2
  73. package/dist/shared/index.d.ts +1 -1
  74. package/dist/shared/index.js +17 -13
  75. package/dist/shared/types/apiConnection.d.ts +12 -12
  76. package/dist/shared/types/apiConnection.js +2 -2
  77. package/dist/shared/types/appsumo.d.ts +16 -16
  78. package/dist/shared/types/appsumo.js +12 -12
  79. package/dist/shared/types/errors.d.ts +5 -5
  80. package/dist/shared/types/errors.js +28 -28
  81. package/dist/shared/types/teams.d.ts +9 -9
  82. package/dist/shared/types/teams.js +2 -2
  83. package/dist/shared/types/userSettings.d.ts +43 -29
  84. package/dist/shared/types/userSettings.js +2 -2
  85. package/dist/utils.d.ts +3 -3
  86. package/dist/utils.js +24 -25
  87. package/dist/workspaces/index.d.ts +176 -176
  88. package/dist/workspaces/index.js +419 -415
  89. package/dist/workspaces/index.test.d.ts +1 -1
  90. package/dist/workspaces/index.test.js +908 -903
  91. package/dist/workspaces/types.d.ts +294 -291
  92. package/dist/workspaces/types.js +2 -2
  93. package/package.json +13 -13
@@ -1,5 +1,5 @@
1
- export default class AppError extends Error {
2
- readonly status?: number;
3
- readonly code?: string;
4
- constructor(message: string, status?: number, code?: string);
5
- }
1
+ export default class AppError extends Error {
2
+ readonly status?: number;
3
+ readonly code?: string;
4
+ constructor(message: string, status?: number, code?: string);
5
+ }
@@ -1,28 +1,28 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- var AppError = /** @class */ (function (_super) {
19
- __extends(AppError, _super);
20
- function AppError(message, status, code) {
21
- var _this = _super.call(this, message) || this;
22
- _this.status = status;
23
- _this.code = code;
24
- return _this;
25
- }
26
- return AppError;
27
- }(Error));
28
- exports.default = AppError;
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ var AppError = /** @class */ (function (_super) {
19
+ __extends(AppError, _super);
20
+ function AppError(message, status, code) {
21
+ var _this = _super.call(this, message) || this;
22
+ _this.status = status;
23
+ _this.code = code;
24
+ return _this;
25
+ }
26
+ return AppError;
27
+ }(Error));
28
+ exports.default = AppError;
@@ -1,9 +1,9 @@
1
- export interface TeamsSettings {
2
- isAdmin: boolean;
3
- bucket: string;
4
- bridge_mnemonic: string;
5
- bridge_password: string;
6
- bridge_user: string;
7
- root_folder_id: number;
8
- total_members: number;
9
- }
1
+ export interface TeamsSettings {
2
+ isAdmin: boolean;
3
+ bucket: string;
4
+ bridge_mnemonic: string;
5
+ bridge_password: string;
6
+ bridge_user: string;
7
+ root_folder_id: number;
8
+ total_members: number;
9
+ }
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,29 +1,43 @@
1
- import { AppSumoDetails } from './appsumo';
2
- export declare type UUID = string;
3
- export interface UserSettings {
4
- userId: string;
5
- uuid: UUID;
6
- email: string;
7
- name: string;
8
- lastname: string;
9
- username: string;
10
- bridgeUser: string;
11
- bucket: string;
12
- backupsBucket: string | null;
13
- root_folder_id: number;
14
- rootFolderId: string;
15
- rootFolderUuid: string | undefined;
16
- sharedWorkspace: boolean;
17
- credit: number;
18
- mnemonic: string;
19
- privateKey: string;
20
- publicKey: string;
21
- revocationKey: string;
22
- teams?: boolean;
23
- appSumoDetails: AppSumoDetails | null;
24
- registerCompleted: boolean;
25
- hasReferralsProgram: boolean;
26
- createdAt: Date;
27
- avatar: string | null;
28
- emailVerified: boolean;
29
- }
1
+ import { AppSumoDetails } from './appsumo';
2
+ export type UUID = string;
3
+ export interface UserSettings {
4
+ userId: string;
5
+ uuid: UUID;
6
+ email: string;
7
+ name: string;
8
+ lastname: string;
9
+ username: string;
10
+ bridgeUser: string;
11
+ bucket: string;
12
+ backupsBucket: string | null;
13
+ root_folder_id: number;
14
+ rootFolderId: string;
15
+ rootFolderUuid: string | undefined;
16
+ sharedWorkspace: boolean;
17
+ credit: number;
18
+ mnemonic: string;
19
+ /**
20
+ / @deprecated The individual fields for keys should not be used
21
+ */
22
+ privateKey: string;
23
+ publicKey: string;
24
+ revocationKey: string;
25
+ keys: {
26
+ ecc: {
27
+ privateKey: string;
28
+ publicKey: string;
29
+ revocationKey: string;
30
+ };
31
+ kyber: {
32
+ privateKyberKey: string;
33
+ publicKyberKey: string;
34
+ };
35
+ };
36
+ teams?: boolean;
37
+ appSumoDetails: AppSumoDetails | null;
38
+ registerCompleted: boolean;
39
+ hasReferralsProgram: boolean;
40
+ createdAt: Date;
41
+ avatar: string | null;
42
+ emailVerified: boolean;
43
+ }
@@ -1,2 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { AxiosError } from 'axios';
2
- export declare function extractAxiosErrorMessage(err: AxiosError): string;
3
- export declare function isHexString(string: string): boolean;
1
+ import { AxiosError } from 'axios';
2
+ export declare function extractAxiosErrorMessage(err: AxiosError): string;
3
+ export declare function isHexString(string: string): boolean;
package/dist/utils.js CHANGED
@@ -1,25 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isHexString = exports.extractAxiosErrorMessage = void 0;
4
- function extractAxiosErrorMessage(err) {
5
- var errMsg;
6
- var error = err;
7
- var isServerError = !!error.response;
8
- var serverUnavailable = !!error.request;
9
- if (isServerError) {
10
- errMsg = error.response.data.error;
11
- }
12
- else if (serverUnavailable) {
13
- errMsg = 'Server not available';
14
- }
15
- else {
16
- errMsg = error.message;
17
- }
18
- return errMsg;
19
- }
20
- exports.extractAxiosErrorMessage = extractAxiosErrorMessage;
21
- function isHexString(string) {
22
- // TODO: replace with proper library
23
- return /^([0-9a-fA-F]{2})+$/.test(string);
24
- }
25
- exports.isHexString = isHexString;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractAxiosErrorMessage = extractAxiosErrorMessage;
4
+ exports.isHexString = isHexString;
5
+ function extractAxiosErrorMessage(err) {
6
+ var errMsg;
7
+ var error = err;
8
+ var isServerError = !!error.response;
9
+ var serverUnavailable = !!error.request;
10
+ if (isServerError) {
11
+ errMsg = error.response.data.error;
12
+ }
13
+ else if (serverUnavailable) {
14
+ errMsg = 'Server not available';
15
+ }
16
+ else {
17
+ errMsg = error.message;
18
+ }
19
+ return errMsg;
20
+ }
21
+ function isHexString(string) {
22
+ // TODO: replace with proper library
23
+ return /^([0-9a-fA-F]{2})+$/.test(string);
24
+ }
@@ -1,176 +1,176 @@
1
- import { Token } from '../auth';
2
- import { ListAllSharedFoldersResponse, SharingMeta } from '../drive/share/types';
3
- import { CreateFolderResponse, DriveFileData, FetchPaginatedFolderContentResponse, FetchTrashContentResponse } from '../drive/storage/types';
4
- import { ApiSecurity, ApiUrl, AppDetails } from '../shared';
5
- import { RequestCanceler } from '../shared/http/client';
6
- import { CreateFolderPayload, CreateTeamData, CreateWorkspaceSharingPayload, FileEntry, GetMemberDetailsResponse, GetMemberUsageResponse, InviteMemberBody, ListWorkspaceSharedItemsResponse, OrderByOptions, PendingInvitesResponse, Workspace, WorkspaceCredentialsDetails, WorkspaceMembers, WorkspacePendingInvitations, WorkspaceSetupInfo, WorkspacesResponse, WorkspaceTeamResponse, TeamMembers, UsersAndTeamsAnItemIsShareWidthResponse, WorkspaceUser, WorkspaceUsage } from './types';
7
- export declare class Workspaces {
8
- private readonly client;
9
- private readonly appDetails;
10
- private readonly apiSecurity;
11
- static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity: ApiSecurity): Workspaces;
12
- private constructor();
13
- /**
14
- * Returns the needed headers for the module requests
15
- * @private
16
- */
17
- private headers;
18
- private getRequestHeaders;
19
- getWorkspaces(): Promise<WorkspacesResponse>;
20
- getPendingWorkspaces(): Promise<WorkspacesResponse>;
21
- getPendingInvites(): Promise<PendingInvitesResponse>;
22
- validateWorkspaceInvite(inviteId: string): Promise<string>;
23
- /**
24
- * Uploads an avatar for a specific workspace.
25
- * @param workspaceId The UUID of the workspace to upload the avatar for.
26
- * @param avatar The avatar to upload.
27
- * @returns The response from the server.
28
- */
29
- uploadWorkspaceAvatar(workspaceId: string, avatar: Blob): Promise<void>;
30
- deleteWorkspaceAvatar(workspaceId: string): Promise<void>;
31
- setupWorkspace({ workspaceId, name, address, description, encryptedMnemonic, }: WorkspaceSetupInfo): Promise<void>;
32
- getWorkspaceUsage(workspaceId: string): Promise<WorkspaceUsage>;
33
- editWorkspace(workspaceId: string, details: {
34
- name?: string;
35
- description?: string;
36
- address?: string;
37
- }): Promise<void>;
38
- updateAvatar(workspaceId: string, payload: {
39
- avatar: Blob;
40
- }): Promise<{
41
- avatar: string;
42
- }>;
43
- deleteAvatar(workspaceId: string): Promise<void>;
44
- createTeam({ workspaceId, name, managerId }: CreateTeamData): Promise<void>;
45
- getWorkspacesMembers(workspaceId: string): Promise<WorkspaceMembers>;
46
- getWorkspacesTeams(workspaceId: string): Promise<WorkspaceTeamResponse>;
47
- editTeam({ teamId, name }: {
48
- teamId: string;
49
- name: string;
50
- }): Promise<void>;
51
- deleteTeam({ workspaceId, teamId }: {
52
- workspaceId: string;
53
- teamId: string;
54
- }): Promise<void>;
55
- getWorkspacesTeamMembers(teamId: string): Promise<TeamMembers>;
56
- addTeamUser(teamId: string, userUuid: string): Promise<void>;
57
- removeTeamUser(teamId: string, userUuid: string): Promise<void>;
58
- changeTeamManager(workspaceId: string, teamId: string, userUuid: string): Promise<void>;
59
- getPersonalTrash(workspaceId: string, type: 'file' | 'folder', offset?: number, limit?: number): Promise<FetchTrashContentResponse>;
60
- emptyPersonalTrash(workspaceId: string): Promise<void>;
61
- changeUserRole(teamId: string, memberId: string, role: string): Promise<void>;
62
- inviteMemberToWorkspace({ workspaceId, invitedUserEmail, spaceLimitBytes, encryptedMnemonicInBase64, encryptionAlgorithm, message, }: InviteMemberBody): Promise<void>;
63
- leaveWorkspace(workspaceId: string): Promise<void>;
64
- getMemberDetails(workspaceId: string, memberId: string): Promise<GetMemberDetailsResponse>;
65
- modifyMemberUsage(workspaceId: string, memberId: string, spaceLimitBytes: number): Promise<WorkspaceUser>;
66
- getMemberUsage(workspaceId: string): Promise<GetMemberUsageResponse>;
67
- deactivateMember(workspaceId: string, memberId: string): Promise<void>;
68
- activateMember(workspaceId: string, memberId: string): Promise<void>;
69
- removeMember(workspaceId: string, memberId: string): Promise<void>;
70
- acceptInvitation(inviteId: string, token: string): Promise<void>;
71
- declineInvitation(inviteId: string, token: string): Promise<void>;
72
- getWorkspaceCredentials(workspaceId: string): Promise<WorkspaceCredentialsDetails>;
73
- createFileEntry(fileEntry: FileEntry, workspaceId: string, resourcesToken?: Token): Promise<DriveFileData>;
74
- /**
75
- * Creates a new folder in the specified workspace.
76
- *
77
- * @param {CreateFolderPayload} options - The options for creating the folder.
78
- * @param {string} options.workspaceId - The ID of the workspace.
79
- * @param {string} options.plainName - The plain name of the folder.
80
- * @param {string} options.parentFolderUuid - The UUID of the parent folder.
81
- * @return {[Promise<CreateFolderResponse>, RequestCanceler]} A tuple containing a promise to get the API response and a function to cancel the request.
82
- */
83
- createFolder({ workspaceId, plainName, parentFolderUuid, }: CreateFolderPayload): [Promise<CreateFolderResponse>, RequestCanceler];
84
- /**
85
- * Retrieves a paginated list of folders within a specific folder in a workspace.
86
- *
87
- * @param {string} workspaceId - The ID of the workspace.
88
- * @param {string} folderUUID - The UUID of the folder.
89
- * @param {number} [offset=0] - The position of the first file to return.
90
- * @param {number} [limit=50] - The max number of files to be returned.
91
- * @param {string} [sort=''] - The reference column to sort it.
92
- * @param {string} [order=''] - The order to be followed.
93
- * @return {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
94
- */
95
- getFolders(workspaceId: string, folderUUID: string, offset?: number, limit?: number, sort?: string, order?: string): [Promise<FetchPaginatedFolderContentResponse>, RequestCanceler];
96
- /**
97
- * Retrieves a paginated list of files within a specific folder in a workspace.
98
- *
99
- * @param {string} workspaceId - The ID of the workspace.
100
- * @param {string} folderUUID - The UUID of the folder.
101
- * @param {number} [offset=0] - The position of the first file to return.
102
- * @param {number} [limit=50] - The max number of files to be returned.
103
- * @param {string} [sort=''] - The reference column to sort it.
104
- * @param {string} [order=''] - The order to be followed.
105
- * @return {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
106
- */
107
- getFiles(workspaceId: string, folderUUID: string, offset?: number, limit?: number, sort?: string, order?: string): [Promise<FetchPaginatedFolderContentResponse>, RequestCanceler];
108
- getWorkspacePendingInvitations(workspaceId: string, limit: number, offset: number): Promise<WorkspacePendingInvitations[]>;
109
- /**
110
- * Creates a new sharing for a workspace item.
111
- *
112
- * @param {CreateWorkspaceSharingPayload} options - The options for creating the sharing.
113
- * @param {string} options.workspaceId - The ID of the workspace.
114
- * @param {string} options.teamUUID - The UUID of the team.
115
- * @param {...CreateSharingPayload} options.createSharingPayload - The payload for creating the sharing.
116
- * @returns {Promise<SharingMeta>} A promise that resolves to the sharing metadata.
117
- */
118
- shareItem({ workspaceId, teamUUID, ...createSharingPayload }: CreateWorkspaceSharingPayload): Promise<SharingMeta>;
119
- validateWorkspaceInvitation(inviteId: string): Promise<{
120
- uuid: string;
121
- }>;
122
- /**
123
- * Returns shared files in teams.
124
- * @param orderBy
125
- * @deprecated use `getWorkspaceTeamSharedFilesV2` call instead.
126
- */
127
- getWorkspaceTeamSharedFiles(workspaceId: string, teamId: string, orderBy?: OrderByOptions): [Promise<ListAllSharedFoldersResponse>, RequestCanceler];
128
- /**
129
- * Returns shared files in teams.
130
- * @param orderBy
131
- */
132
- getWorkspaceTeamSharedFilesV2(workspaceId: string, orderBy?: OrderByOptions): [Promise<ListAllSharedFoldersResponse>, RequestCanceler];
133
- /**
134
- * Returns shared folders in teams.
135
- * @param orderBy
136
- * @deprecated use `getWorkspaceTeamSharedFoldersV2` call instead.
137
- */
138
- getWorkspaceTeamSharedFolders(workspaceId: string, teamId: string, orderBy?: OrderByOptions): [Promise<ListAllSharedFoldersResponse>, RequestCanceler];
139
- /**
140
- * Returns shared folders in teams.
141
- * @param orderBy
142
- */
143
- getWorkspaceTeamSharedFoldersV2(workspaceId: string, orderBy?: OrderByOptions): [Promise<ListAllSharedFoldersResponse>, RequestCanceler];
144
- /**
145
- * Returns files inside a shared folders with teams.
146
- * @param orderBy
147
- * @deprecated use `getWorkspaceTeamSharedFolderFilesV2` call instead.
148
- */
149
- getWorkspaceTeamSharedFolderFiles(workspaceId: string, teamId: string, sharedFolderUUID: string, page?: number, perPage?: number, token?: string, orderBy?: OrderByOptions): [Promise<ListWorkspaceSharedItemsResponse>, RequestCanceler];
150
- /**
151
- * Returns files inside a shared folders with teams.
152
- * @param orderBy
153
- */
154
- getWorkspaceTeamSharedFolderFilesV2(workspaceId: string, sharedFolderUUID: string, page?: number, perPage?: number, token?: string, orderBy?: OrderByOptions): [Promise<ListWorkspaceSharedItemsResponse>, RequestCanceler];
155
- /**
156
- * Returns folders inside a shared folders with teams.
157
- * @param orderBy
158
- * @deprecated use `getWorkspaceTeamSharedFolderFoldersV2` call instead.
159
- */
160
- getWorkspaceTeamSharedFolderFolders(workspaceId: string, teamId: string, sharedFolderUUID: string, page?: number, perPage?: number, token?: string, orderBy?: OrderByOptions): [Promise<ListWorkspaceSharedItemsResponse>, RequestCanceler];
161
- /**
162
- * Returns folders inside a shared folders with teams.
163
- * @param orderBy
164
- */
165
- getWorkspaceTeamSharedFolderFoldersV2(workspaceId: string, sharedFolderUUID: string, page?: number, perPage?: number, token?: string, orderBy?: OrderByOptions): [Promise<ListWorkspaceSharedItemsResponse>, RequestCanceler];
166
- /**
167
- * Returns users and teams an item is shared with.
168
- */
169
- getUsersAndTeamsAnItemIsShareWidth({ workspaceId, itemType, itemId, }: {
170
- workspaceId: string;
171
- itemType: 'folder' | 'file';
172
- itemId: string;
173
- }): [Promise<UsersAndTeamsAnItemIsShareWidthResponse>, RequestCanceler];
174
- getWorkspace(workspaceId: string): Promise<Workspace>;
175
- }
176
- export * from './types';
1
+ import { Token } from '../auth';
2
+ import { ListAllSharedFoldersResponse, SharingMeta } from '../drive/share/types';
3
+ import { CreateFolderResponse, DriveFileData, FetchPaginatedFolderContentResponse, FetchTrashContentResponse } from '../drive/storage/types';
4
+ import { ApiSecurity, ApiUrl, AppDetails } from '../shared';
5
+ import { RequestCanceler } from '../shared/http/client';
6
+ import { CreateFolderPayload, CreateTeamData, CreateWorkspaceSharingPayload, FileEntry, GetMemberDetailsResponse, GetMemberUsageResponse, InviteMemberBody, ListWorkspaceSharedItemsResponse, OrderByOptions, PendingInvitesResponse, Workspace, WorkspaceCredentialsDetails, WorkspaceMembers, WorkspacePendingInvitations, WorkspaceSetupInfo, WorkspacesResponse, WorkspaceTeamResponse, TeamMembers, UsersAndTeamsAnItemIsShareWidthResponse, WorkspaceUser, WorkspaceUsage } from './types';
7
+ export declare class Workspaces {
8
+ private readonly client;
9
+ private readonly appDetails;
10
+ private readonly apiSecurity;
11
+ static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity: ApiSecurity): Workspaces;
12
+ private constructor();
13
+ /**
14
+ * Returns the needed headers for the module requests
15
+ * @private
16
+ */
17
+ private headers;
18
+ private getRequestHeaders;
19
+ getWorkspaces(): Promise<WorkspacesResponse>;
20
+ getPendingWorkspaces(): Promise<WorkspacesResponse>;
21
+ getPendingInvites(): Promise<PendingInvitesResponse>;
22
+ validateWorkspaceInvite(inviteId: string): Promise<string>;
23
+ /**
24
+ * Uploads an avatar for a specific workspace.
25
+ * @param workspaceId The UUID of the workspace to upload the avatar for.
26
+ * @param avatar The avatar to upload.
27
+ * @returns The response from the server.
28
+ */
29
+ uploadWorkspaceAvatar(workspaceId: string, avatar: Blob): Promise<void>;
30
+ deleteWorkspaceAvatar(workspaceId: string): Promise<void>;
31
+ setupWorkspace({ workspaceId, name, address, description, encryptedMnemonic, hybridModeEnabled, }: WorkspaceSetupInfo): Promise<void>;
32
+ getWorkspaceUsage(workspaceId: string): Promise<WorkspaceUsage>;
33
+ editWorkspace(workspaceId: string, details: {
34
+ name?: string;
35
+ description?: string;
36
+ address?: string;
37
+ }): Promise<void>;
38
+ updateAvatar(workspaceId: string, payload: {
39
+ avatar: Blob;
40
+ }): Promise<{
41
+ avatar: string;
42
+ }>;
43
+ deleteAvatar(workspaceId: string): Promise<void>;
44
+ createTeam({ workspaceId, name, managerId }: CreateTeamData): Promise<void>;
45
+ getWorkspacesMembers(workspaceId: string): Promise<WorkspaceMembers>;
46
+ getWorkspacesTeams(workspaceId: string): Promise<WorkspaceTeamResponse>;
47
+ editTeam({ teamId, name }: {
48
+ teamId: string;
49
+ name: string;
50
+ }): Promise<void>;
51
+ deleteTeam({ workspaceId, teamId }: {
52
+ workspaceId: string;
53
+ teamId: string;
54
+ }): Promise<void>;
55
+ getWorkspacesTeamMembers(teamId: string): Promise<TeamMembers>;
56
+ addTeamUser(teamId: string, userUuid: string): Promise<void>;
57
+ removeTeamUser(teamId: string, userUuid: string): Promise<void>;
58
+ changeTeamManager(workspaceId: string, teamId: string, userUuid: string): Promise<void>;
59
+ getPersonalTrash(workspaceId: string, type: 'file' | 'folder', offset?: number, limit?: number): Promise<FetchTrashContentResponse>;
60
+ emptyPersonalTrash(workspaceId: string): Promise<void>;
61
+ changeUserRole(teamId: string, memberId: string, role: string): Promise<void>;
62
+ inviteMemberToWorkspace({ workspaceId, invitedUserEmail, spaceLimitBytes, encryptedMnemonicInBase64, encryptionAlgorithm, message, }: InviteMemberBody): Promise<void>;
63
+ leaveWorkspace(workspaceId: string): Promise<void>;
64
+ getMemberDetails(workspaceId: string, memberId: string): Promise<GetMemberDetailsResponse>;
65
+ modifyMemberUsage(workspaceId: string, memberId: string, spaceLimitBytes: number): Promise<WorkspaceUser>;
66
+ getMemberUsage(workspaceId: string): Promise<GetMemberUsageResponse>;
67
+ deactivateMember(workspaceId: string, memberId: string): Promise<void>;
68
+ activateMember(workspaceId: string, memberId: string): Promise<void>;
69
+ removeMember(workspaceId: string, memberId: string): Promise<void>;
70
+ acceptInvitation(inviteId: string, token: string): Promise<void>;
71
+ declineInvitation(inviteId: string, token: string): Promise<void>;
72
+ getWorkspaceCredentials(workspaceId: string): Promise<WorkspaceCredentialsDetails>;
73
+ createFileEntry(fileEntry: FileEntry, workspaceId: string, resourcesToken?: Token): Promise<DriveFileData>;
74
+ /**
75
+ * Creates a new folder in the specified workspace.
76
+ *
77
+ * @param {CreateFolderPayload} options - The options for creating the folder.
78
+ * @param {string} options.workspaceId - The ID of the workspace.
79
+ * @param {string} options.plainName - The plain name of the folder.
80
+ * @param {string} options.parentFolderUuid - The UUID of the parent folder.
81
+ * @return {[Promise<CreateFolderResponse>, RequestCanceler]} A tuple containing a promise to get the API response and a function to cancel the request.
82
+ */
83
+ createFolder({ workspaceId, plainName, parentFolderUuid, }: CreateFolderPayload): [Promise<CreateFolderResponse>, RequestCanceler];
84
+ /**
85
+ * Retrieves a paginated list of folders within a specific folder in a workspace.
86
+ *
87
+ * @param {string} workspaceId - The ID of the workspace.
88
+ * @param {string} folderUUID - The UUID of the folder.
89
+ * @param {number} [offset=0] - The position of the first file to return.
90
+ * @param {number} [limit=50] - The max number of files to be returned.
91
+ * @param {string} [sort=''] - The reference column to sort it.
92
+ * @param {string} [order=''] - The order to be followed.
93
+ * @return {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
94
+ */
95
+ getFolders(workspaceId: string, folderUUID: string, offset?: number, limit?: number, sort?: string, order?: string): [Promise<FetchPaginatedFolderContentResponse>, RequestCanceler];
96
+ /**
97
+ * Retrieves a paginated list of files within a specific folder in a workspace.
98
+ *
99
+ * @param {string} workspaceId - The ID of the workspace.
100
+ * @param {string} folderUUID - The UUID of the folder.
101
+ * @param {number} [offset=0] - The position of the first file to return.
102
+ * @param {number} [limit=50] - The max number of files to be returned.
103
+ * @param {string} [sort=''] - The reference column to sort it.
104
+ * @param {string} [order=''] - The order to be followed.
105
+ * @return {[Promise<FetchPaginatedFolderContentResponse>, RequestCanceler]} An array containing a promise to get the API response and a function to cancel the request.
106
+ */
107
+ getFiles(workspaceId: string, folderUUID: string, offset?: number, limit?: number, sort?: string, order?: string): [Promise<FetchPaginatedFolderContentResponse>, RequestCanceler];
108
+ getWorkspacePendingInvitations(workspaceId: string, limit: number, offset: number): Promise<WorkspacePendingInvitations[]>;
109
+ /**
110
+ * Creates a new sharing for a workspace item.
111
+ *
112
+ * @param {CreateWorkspaceSharingPayload} options - The options for creating the sharing.
113
+ * @param {string} options.workspaceId - The ID of the workspace.
114
+ * @param {string} options.teamUUID - The UUID of the team.
115
+ * @param {...CreateSharingPayload} options.createSharingPayload - The payload for creating the sharing.
116
+ * @returns {Promise<SharingMeta>} A promise that resolves to the sharing metadata.
117
+ */
118
+ shareItem({ workspaceId, teamUUID, ...createSharingPayload }: CreateWorkspaceSharingPayload): Promise<SharingMeta>;
119
+ validateWorkspaceInvitation(inviteId: string): Promise<{
120
+ uuid: string;
121
+ }>;
122
+ /**
123
+ * Returns shared files in teams.
124
+ * @param orderBy
125
+ * @deprecated use `getWorkspaceTeamSharedFilesV2` call instead.
126
+ */
127
+ getWorkspaceTeamSharedFiles(workspaceId: string, teamId: string, orderBy?: OrderByOptions): [Promise<ListAllSharedFoldersResponse>, RequestCanceler];
128
+ /**
129
+ * Returns shared files in teams.
130
+ * @param orderBy
131
+ */
132
+ getWorkspaceTeamSharedFilesV2(workspaceId: string, orderBy?: OrderByOptions): [Promise<ListAllSharedFoldersResponse>, RequestCanceler];
133
+ /**
134
+ * Returns shared folders in teams.
135
+ * @param orderBy
136
+ * @deprecated use `getWorkspaceTeamSharedFoldersV2` call instead.
137
+ */
138
+ getWorkspaceTeamSharedFolders(workspaceId: string, teamId: string, orderBy?: OrderByOptions): [Promise<ListAllSharedFoldersResponse>, RequestCanceler];
139
+ /**
140
+ * Returns shared folders in teams.
141
+ * @param orderBy
142
+ */
143
+ getWorkspaceTeamSharedFoldersV2(workspaceId: string, orderBy?: OrderByOptions): [Promise<ListAllSharedFoldersResponse>, RequestCanceler];
144
+ /**
145
+ * Returns files inside a shared folders with teams.
146
+ * @param orderBy
147
+ * @deprecated use `getWorkspaceTeamSharedFolderFilesV2` call instead.
148
+ */
149
+ getWorkspaceTeamSharedFolderFiles(workspaceId: string, teamId: string, sharedFolderUUID: string, page?: number, perPage?: number, token?: string, orderBy?: OrderByOptions): [Promise<ListWorkspaceSharedItemsResponse>, RequestCanceler];
150
+ /**
151
+ * Returns files inside a shared folders with teams.
152
+ * @param orderBy
153
+ */
154
+ getWorkspaceTeamSharedFolderFilesV2(workspaceId: string, sharedFolderUUID: string, page?: number, perPage?: number, token?: string, orderBy?: OrderByOptions): [Promise<ListWorkspaceSharedItemsResponse>, RequestCanceler];
155
+ /**
156
+ * Returns folders inside a shared folders with teams.
157
+ * @param orderBy
158
+ * @deprecated use `getWorkspaceTeamSharedFolderFoldersV2` call instead.
159
+ */
160
+ getWorkspaceTeamSharedFolderFolders(workspaceId: string, teamId: string, sharedFolderUUID: string, page?: number, perPage?: number, token?: string, orderBy?: OrderByOptions): [Promise<ListWorkspaceSharedItemsResponse>, RequestCanceler];
161
+ /**
162
+ * Returns folders inside a shared folders with teams.
163
+ * @param orderBy
164
+ */
165
+ getWorkspaceTeamSharedFolderFoldersV2(workspaceId: string, sharedFolderUUID: string, page?: number, perPage?: number, token?: string, orderBy?: OrderByOptions): [Promise<ListWorkspaceSharedItemsResponse>, RequestCanceler];
166
+ /**
167
+ * Returns users and teams an item is shared with.
168
+ */
169
+ getUsersAndTeamsAnItemIsShareWidth({ workspaceId, itemType, itemId, }: {
170
+ workspaceId: string;
171
+ itemType: 'folder' | 'file';
172
+ itemId: string;
173
+ }): [Promise<UsersAndTeamsAnItemIsShareWidthResponse>, RequestCanceler];
174
+ getWorkspace(workspaceId: string): Promise<Workspace>;
175
+ }
176
+ export * from './types';