@marcuth/mediafire 1.3.0
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.
- package/LICENSE +21 -0
- package/README.md +228 -0
- package/dist/enums/action-on-duplicate-file.d.ts +5 -0
- package/dist/enums/action-on-duplicate-file.js +9 -0
- package/dist/enums/content-type.d.ts +5 -0
- package/dist/enums/content-type.js +9 -0
- package/dist/enums/details.d.ts +5 -0
- package/dist/enums/details.js +9 -0
- package/dist/enums/index.d.ts +6 -0
- package/dist/enums/index.js +22 -0
- package/dist/enums/order-by.d.ts +6 -0
- package/dist/enums/order-by.js +10 -0
- package/dist/enums/order-direction.d.ts +4 -0
- package/dist/enums/order-direction.js +8 -0
- package/dist/enums/upload-status.d.ts +13 -0
- package/dist/enums/upload-status.js +17 -0
- package/dist/error.d.ts +3 -0
- package/dist/error.js +10 -0
- package/dist/files-service.d.ts +154 -0
- package/dist/files-service.js +107 -0
- package/dist/folders-service.d.ts +165 -0
- package/dist/folders-service.js +65 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +20 -0
- package/dist/interfaces/files/get-file-info.d.ts +32 -0
- package/dist/interfaces/files/get-file-info.js +2 -0
- package/dist/interfaces/files/get-links.d.ts +17 -0
- package/dist/interfaces/files/get-links.js +2 -0
- package/dist/interfaces/files/index.d.ts +3 -0
- package/dist/interfaces/files/index.js +19 -0
- package/dist/interfaces/files/poll-upload.d.ts +20 -0
- package/dist/interfaces/files/poll-upload.js +2 -0
- package/dist/interfaces/files/upload-file.d.ts +13 -0
- package/dist/interfaces/files/upload-file.js +2 -0
- package/dist/interfaces/folders/get-contents.d.ts +53 -0
- package/dist/interfaces/folders/get-contents.js +2 -0
- package/dist/interfaces/folders/get-folder-info.d.ts +19 -0
- package/dist/interfaces/folders/get-folder-info.js +2 -0
- package/dist/interfaces/folders/index.d.ts +2 -0
- package/dist/interfaces/folders/index.js +18 -0
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/index.js +19 -0
- package/dist/interfaces/user/get-session-token-response.d.ts +12 -0
- package/dist/interfaces/user/get-session-token-response.js +2 -0
- package/dist/interfaces/user/index.d.ts +1 -0
- package/dist/interfaces/user/index.js +17 -0
- package/dist/mediafire.d.ts +35 -0
- package/dist/mediafire.js +96 -0
- package/dist/utils/constants.d.ts +6 -0
- package/dist/utils/constants.js +9 -0
- package/dist/utils/delay.d.ts +1 -0
- package/dist/utils/delay.js +6 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +17 -0
- package/package.json +33 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { OrderDirection } from "./enums/order-direction";
|
|
2
|
+
import { ContentType } from "./enums/content-type";
|
|
3
|
+
import { OrderBy } from "./enums/order-by";
|
|
4
|
+
import { Details } from "./enums/details";
|
|
5
|
+
import { Mediafire } from "./mediafire";
|
|
6
|
+
export type GetFolderInfoOptions = {
|
|
7
|
+
folderKey: string;
|
|
8
|
+
deviceId?: string;
|
|
9
|
+
details?: Details | `${Details}`;
|
|
10
|
+
};
|
|
11
|
+
export type GetFolderContentOptions = {
|
|
12
|
+
folderKey: string;
|
|
13
|
+
contentType?: ContentType | `${ContentType}`;
|
|
14
|
+
filter?: string;
|
|
15
|
+
orderBy?: OrderBy | `${OrderBy}`;
|
|
16
|
+
orderDirection?: OrderDirection | `${OrderDirection}`;
|
|
17
|
+
chunk?: number;
|
|
18
|
+
details?: Details | `${Details}`;
|
|
19
|
+
};
|
|
20
|
+
export type GetInfoByPathOptions = {
|
|
21
|
+
folderPath: string;
|
|
22
|
+
};
|
|
23
|
+
export type GetFolderContentsByPathOptions = Omit<GetFolderContentOptions & {
|
|
24
|
+
folderPath: string;
|
|
25
|
+
}, "folderKey">;
|
|
26
|
+
export declare class FoldersService {
|
|
27
|
+
private readonly mediafire;
|
|
28
|
+
constructor(mediafire: Mediafire);
|
|
29
|
+
getInfo({ folderKey, deviceId, details }: GetFolderInfoOptions): Promise<{
|
|
30
|
+
action: string;
|
|
31
|
+
folder_info: {
|
|
32
|
+
folderkey: string;
|
|
33
|
+
name: string;
|
|
34
|
+
file_count: string;
|
|
35
|
+
folder_count: string;
|
|
36
|
+
revision: string;
|
|
37
|
+
owner_name: string;
|
|
38
|
+
avatar: string;
|
|
39
|
+
dropbox_enabled: string;
|
|
40
|
+
flag: string;
|
|
41
|
+
};
|
|
42
|
+
result: string;
|
|
43
|
+
new_key: string;
|
|
44
|
+
current_api_version: string;
|
|
45
|
+
}>;
|
|
46
|
+
getContents({ folderKey, contentType, filter, orderBy, orderDirection, chunk, details }: GetFolderContentOptions): Promise<{
|
|
47
|
+
action: string;
|
|
48
|
+
asynchronous: string;
|
|
49
|
+
folder_content: {
|
|
50
|
+
chunk_size: string;
|
|
51
|
+
content_type: string;
|
|
52
|
+
chunk_number: string;
|
|
53
|
+
folderkey: string;
|
|
54
|
+
folders?: Array<{
|
|
55
|
+
folderkey: string;
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
tags: string;
|
|
59
|
+
privacy: string;
|
|
60
|
+
created: string;
|
|
61
|
+
revision: string;
|
|
62
|
+
flag: string;
|
|
63
|
+
file_count: string;
|
|
64
|
+
folder_count: string;
|
|
65
|
+
dropbox_enabled: string;
|
|
66
|
+
created_utc: string;
|
|
67
|
+
}>;
|
|
68
|
+
files?: Array<{
|
|
69
|
+
quickkey: string;
|
|
70
|
+
hash: string;
|
|
71
|
+
filename: string;
|
|
72
|
+
description: string;
|
|
73
|
+
size: string;
|
|
74
|
+
privacy: string;
|
|
75
|
+
created: string;
|
|
76
|
+
password_protected: string;
|
|
77
|
+
mimetype: string;
|
|
78
|
+
filetype: string;
|
|
79
|
+
view: string;
|
|
80
|
+
edit: string;
|
|
81
|
+
revision: string;
|
|
82
|
+
flag: string;
|
|
83
|
+
downloads: string;
|
|
84
|
+
views: string;
|
|
85
|
+
links: {
|
|
86
|
+
normal_download: string;
|
|
87
|
+
};
|
|
88
|
+
created_utc: string;
|
|
89
|
+
}>;
|
|
90
|
+
more_chunks: string;
|
|
91
|
+
revision: string;
|
|
92
|
+
};
|
|
93
|
+
result: string;
|
|
94
|
+
new_key: string;
|
|
95
|
+
current_api_version: string;
|
|
96
|
+
}>;
|
|
97
|
+
getInfoByPath({ folderPath }: GetInfoByPathOptions): Promise<{
|
|
98
|
+
action: string;
|
|
99
|
+
folder_info: {
|
|
100
|
+
folderkey: string;
|
|
101
|
+
name: string;
|
|
102
|
+
file_count: string;
|
|
103
|
+
folder_count: string;
|
|
104
|
+
revision: string;
|
|
105
|
+
owner_name: string;
|
|
106
|
+
avatar: string;
|
|
107
|
+
dropbox_enabled: string;
|
|
108
|
+
flag: string;
|
|
109
|
+
};
|
|
110
|
+
result: string;
|
|
111
|
+
new_key: string;
|
|
112
|
+
current_api_version: string;
|
|
113
|
+
}>;
|
|
114
|
+
getContentsByPath({ folderPath, ...options }: GetFolderContentsByPathOptions): Promise<{
|
|
115
|
+
action: string;
|
|
116
|
+
asynchronous: string;
|
|
117
|
+
folder_content: {
|
|
118
|
+
chunk_size: string;
|
|
119
|
+
content_type: string;
|
|
120
|
+
chunk_number: string;
|
|
121
|
+
folderkey: string;
|
|
122
|
+
folders?: Array<{
|
|
123
|
+
folderkey: string;
|
|
124
|
+
name: string;
|
|
125
|
+
description: string;
|
|
126
|
+
tags: string;
|
|
127
|
+
privacy: string;
|
|
128
|
+
created: string;
|
|
129
|
+
revision: string;
|
|
130
|
+
flag: string;
|
|
131
|
+
file_count: string;
|
|
132
|
+
folder_count: string;
|
|
133
|
+
dropbox_enabled: string;
|
|
134
|
+
created_utc: string;
|
|
135
|
+
}>;
|
|
136
|
+
files?: Array<{
|
|
137
|
+
quickkey: string;
|
|
138
|
+
hash: string;
|
|
139
|
+
filename: string;
|
|
140
|
+
description: string;
|
|
141
|
+
size: string;
|
|
142
|
+
privacy: string;
|
|
143
|
+
created: string;
|
|
144
|
+
password_protected: string;
|
|
145
|
+
mimetype: string;
|
|
146
|
+
filetype: string;
|
|
147
|
+
view: string;
|
|
148
|
+
edit: string;
|
|
149
|
+
revision: string;
|
|
150
|
+
flag: string;
|
|
151
|
+
downloads: string;
|
|
152
|
+
views: string;
|
|
153
|
+
links: {
|
|
154
|
+
normal_download: string;
|
|
155
|
+
};
|
|
156
|
+
created_utc: string;
|
|
157
|
+
}>;
|
|
158
|
+
more_chunks: string;
|
|
159
|
+
revision: string;
|
|
160
|
+
};
|
|
161
|
+
result: string;
|
|
162
|
+
new_key: string;
|
|
163
|
+
current_api_version: string;
|
|
164
|
+
}>;
|
|
165
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FoldersService = void 0;
|
|
4
|
+
const content_type_1 = require("./enums/content-type");
|
|
5
|
+
const error_1 = require("./error");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
7
|
+
class FoldersService {
|
|
8
|
+
constructor(mediafire) {
|
|
9
|
+
this.mediafire = mediafire;
|
|
10
|
+
}
|
|
11
|
+
async getInfo({ folderKey, deviceId, details }) {
|
|
12
|
+
const action = "folder/get_info";
|
|
13
|
+
const data = await this.mediafire.request(action, {
|
|
14
|
+
folder_key: folderKey,
|
|
15
|
+
device_id: deviceId,
|
|
16
|
+
details: details,
|
|
17
|
+
});
|
|
18
|
+
return data.response;
|
|
19
|
+
}
|
|
20
|
+
async getContents({ folderKey, contentType = content_type_1.ContentType.Both, filter, orderBy, orderDirection, chunk, details }) {
|
|
21
|
+
const action = "folder/get_content";
|
|
22
|
+
const data = await this.mediafire.request(action, {
|
|
23
|
+
folder_key: folderKey,
|
|
24
|
+
content_type: contentType,
|
|
25
|
+
filter: filter,
|
|
26
|
+
order_by: orderBy,
|
|
27
|
+
order_direction: orderDirection,
|
|
28
|
+
chunk: chunk?.toString(),
|
|
29
|
+
details: details,
|
|
30
|
+
});
|
|
31
|
+
return data.response;
|
|
32
|
+
}
|
|
33
|
+
async getInfoByPath({ folderPath }) {
|
|
34
|
+
const parts = folderPath.split(/[\\/]/).filter(part => part.length > 0);
|
|
35
|
+
if (parts.length === 0) {
|
|
36
|
+
return this.getInfo({ folderKey: utils_1.rootFolderKey });
|
|
37
|
+
}
|
|
38
|
+
let currentFolderKey = utils_1.rootFolderKey;
|
|
39
|
+
for (let i = 0; i < parts.length; i++) {
|
|
40
|
+
const partName = parts[i];
|
|
41
|
+
const folderContents = await this.getContents({
|
|
42
|
+
folderKey: currentFolderKey,
|
|
43
|
+
contentType: content_type_1.ContentType.Folders
|
|
44
|
+
});
|
|
45
|
+
const contents = folderContents.folder_content;
|
|
46
|
+
const nextFolder = contents.folders?.find(folder => folder.name === partName);
|
|
47
|
+
if (!nextFolder) {
|
|
48
|
+
throw new error_1.MediafireError(`Folder not found: ${partName} at ${folderPath}`);
|
|
49
|
+
}
|
|
50
|
+
currentFolderKey = nextFolder.folderkey;
|
|
51
|
+
if (i === parts.length - 1) {
|
|
52
|
+
return this.getInfo({ folderKey: currentFolderKey });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
throw new error_1.MediafireError("Folder not found");
|
|
56
|
+
}
|
|
57
|
+
async getContentsByPath({ folderPath, ...options }) {
|
|
58
|
+
const info = await this.getInfoByPath({ folderPath: folderPath });
|
|
59
|
+
return await this.getContents({
|
|
60
|
+
folderKey: info.folder_info.folderkey,
|
|
61
|
+
...options
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.FoldersService = FoldersService;
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./mediafire"), exports);
|
|
18
|
+
__exportStar(require("./enums"), exports);
|
|
19
|
+
__exportStar(require("./interfaces"), exports);
|
|
20
|
+
__exportStar(require("./error"), exports);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface GetFileInfoResponse {
|
|
2
|
+
response: {
|
|
3
|
+
action: string;
|
|
4
|
+
file_info: {
|
|
5
|
+
quickkey: string;
|
|
6
|
+
filename: string;
|
|
7
|
+
ready: string;
|
|
8
|
+
created: string;
|
|
9
|
+
downloads: string;
|
|
10
|
+
description: string;
|
|
11
|
+
size: string;
|
|
12
|
+
privacy: string;
|
|
13
|
+
password_protected: string;
|
|
14
|
+
hash: string;
|
|
15
|
+
filetype: string;
|
|
16
|
+
mimetype: string;
|
|
17
|
+
owner_name: string;
|
|
18
|
+
flag: string;
|
|
19
|
+
parent_folderkey: string;
|
|
20
|
+
revision: string;
|
|
21
|
+
view: string;
|
|
22
|
+
edit: string;
|
|
23
|
+
links: {
|
|
24
|
+
normal_download: string;
|
|
25
|
+
};
|
|
26
|
+
created_utc: string;
|
|
27
|
+
};
|
|
28
|
+
result: string;
|
|
29
|
+
new_key: string;
|
|
30
|
+
current_api_version: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface GetLinksResponse {
|
|
2
|
+
response: {
|
|
3
|
+
action: string;
|
|
4
|
+
links: {
|
|
5
|
+
quickkey: string;
|
|
6
|
+
normal_download: string;
|
|
7
|
+
one_time: {
|
|
8
|
+
download: string;
|
|
9
|
+
};
|
|
10
|
+
}[];
|
|
11
|
+
one_time_key_request_count: string;
|
|
12
|
+
one_time_key_request_max_count: string;
|
|
13
|
+
result: string;
|
|
14
|
+
new_key: string;
|
|
15
|
+
current_api_version: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-file-info"), exports);
|
|
18
|
+
__exportStar(require("./get-links"), exports);
|
|
19
|
+
__exportStar(require("./upload-file"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface PollUploadResponse {
|
|
2
|
+
response: {
|
|
3
|
+
action: string;
|
|
4
|
+
doupload: {
|
|
5
|
+
result: string;
|
|
6
|
+
status: string;
|
|
7
|
+
description: string;
|
|
8
|
+
quickkey: string;
|
|
9
|
+
hash: string;
|
|
10
|
+
filename: string;
|
|
11
|
+
size: string;
|
|
12
|
+
created: string;
|
|
13
|
+
revision: string;
|
|
14
|
+
created_utc: string;
|
|
15
|
+
};
|
|
16
|
+
result: string;
|
|
17
|
+
current_api_version: string;
|
|
18
|
+
new_key?: undefined;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface GetFolderContentsResponse {
|
|
2
|
+
response: {
|
|
3
|
+
action: string;
|
|
4
|
+
asynchronous: string;
|
|
5
|
+
folder_content: {
|
|
6
|
+
chunk_size: string;
|
|
7
|
+
content_type: string;
|
|
8
|
+
chunk_number: string;
|
|
9
|
+
folderkey: string;
|
|
10
|
+
folders?: Array<{
|
|
11
|
+
folderkey: string;
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
tags: string;
|
|
15
|
+
privacy: string;
|
|
16
|
+
created: string;
|
|
17
|
+
revision: string;
|
|
18
|
+
flag: string;
|
|
19
|
+
file_count: string;
|
|
20
|
+
folder_count: string;
|
|
21
|
+
dropbox_enabled: string;
|
|
22
|
+
created_utc: string;
|
|
23
|
+
}>;
|
|
24
|
+
files?: Array<{
|
|
25
|
+
quickkey: string;
|
|
26
|
+
hash: string;
|
|
27
|
+
filename: string;
|
|
28
|
+
description: string;
|
|
29
|
+
size: string;
|
|
30
|
+
privacy: string;
|
|
31
|
+
created: string;
|
|
32
|
+
password_protected: string;
|
|
33
|
+
mimetype: string;
|
|
34
|
+
filetype: string;
|
|
35
|
+
view: string;
|
|
36
|
+
edit: string;
|
|
37
|
+
revision: string;
|
|
38
|
+
flag: string;
|
|
39
|
+
downloads: string;
|
|
40
|
+
views: string;
|
|
41
|
+
links: {
|
|
42
|
+
normal_download: string;
|
|
43
|
+
};
|
|
44
|
+
created_utc: string;
|
|
45
|
+
}>;
|
|
46
|
+
more_chunks: string;
|
|
47
|
+
revision: string;
|
|
48
|
+
};
|
|
49
|
+
result: string;
|
|
50
|
+
new_key: string;
|
|
51
|
+
current_api_version: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface GetFolderInfo {
|
|
2
|
+
response: {
|
|
3
|
+
action: string;
|
|
4
|
+
folder_info: {
|
|
5
|
+
folderkey: string;
|
|
6
|
+
name: string;
|
|
7
|
+
file_count: string;
|
|
8
|
+
folder_count: string;
|
|
9
|
+
revision: string;
|
|
10
|
+
owner_name: string;
|
|
11
|
+
avatar: string;
|
|
12
|
+
dropbox_enabled: string;
|
|
13
|
+
flag: string;
|
|
14
|
+
};
|
|
15
|
+
result: string;
|
|
16
|
+
new_key: string;
|
|
17
|
+
current_api_version: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-contents"), exports);
|
|
18
|
+
__exportStar(require("./get-folder-info"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./files"), exports);
|
|
18
|
+
__exportStar(require("./folders"), exports);
|
|
19
|
+
__exportStar(require("./user"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./get-session-token-response";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-session-token-response"), exports);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import FormData from "form-data";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { FoldersService } from "./folders-service";
|
|
4
|
+
import { FilesService } from "./files-service";
|
|
5
|
+
export type BaseResponseData = {
|
|
6
|
+
response: {
|
|
7
|
+
new_key?: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export type MediafireOptions = {
|
|
11
|
+
email: string;
|
|
12
|
+
password: string;
|
|
13
|
+
appId?: string;
|
|
14
|
+
fileUploadPollDelay?: number;
|
|
15
|
+
};
|
|
16
|
+
export declare class Mediafire {
|
|
17
|
+
private readonly email;
|
|
18
|
+
private readonly password;
|
|
19
|
+
private accessToken?;
|
|
20
|
+
private secretKey?;
|
|
21
|
+
private sessionTime?;
|
|
22
|
+
readonly appId: string;
|
|
23
|
+
readonly folders: FoldersService;
|
|
24
|
+
readonly files: FilesService;
|
|
25
|
+
readonly api: axios.AxiosInstance;
|
|
26
|
+
constructor({ email, password, appId }: MediafireOptions);
|
|
27
|
+
private generateAndPutLogInSignature;
|
|
28
|
+
ensureCredentials(): Promise<{
|
|
29
|
+
accessToken: string;
|
|
30
|
+
secretKey: string;
|
|
31
|
+
sessionTime: string;
|
|
32
|
+
}>;
|
|
33
|
+
logIn(): Promise<void>;
|
|
34
|
+
request<ResponseData extends BaseResponseData>(action: string, params?: Record<string, string | undefined>, body?: FormData | string): Promise<ResponseData>;
|
|
35
|
+
}
|