totalum-api-sdk 3.0.6 → 3.0.7
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/README.MD
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## Totalum API SDK
|
|
1
|
+
## Totalum API SDK
|
|
2
2
|
|
|
3
3
|
Official TypeScript/JavaScript SDK for the Totalum API. This library provides a fully typed, modern interface to interact with all Totalum endpoints.
|
|
4
4
|
|
|
@@ -8,16 +8,6 @@ Official TypeScript/JavaScript SDK for the Totalum API. This library provides a
|
|
|
8
8
|
npm i totalum-api-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## What's New in v3.0
|
|
12
|
-
|
|
13
|
-
- **Native Fetch**: Removed `axios` dependency, now using native `fetch` API (works in Node.js 18+ and browsers)
|
|
14
|
-
- **Typed Responses**: All methods return strongly-typed `TotalumApiResponse<T>` with proper TypeScript support
|
|
15
|
-
- **Better Error Handling**: Introduced `TotalumError` class for structured error handling
|
|
16
|
-
- **Renamed Methods**: More consistent naming (`getItems` → `getRecords`, `getItemById` → `getRecordById`, etc.)
|
|
17
|
-
- **Improved Type Safety**: Full TypeScript support with detailed response types
|
|
18
|
-
- **No Breaking Changes in API**: Same Totalum API, just better developer experience
|
|
19
|
-
|
|
20
|
-
|
|
21
11
|
**Note:** v3.0 requires Node.js 18+ (for native fetch support). If you're using an older Node.js version, you'll need to polyfill `fetch` or upgrade to Node.js 18+.
|
|
22
12
|
|
|
23
13
|
# Usage of TotalumApiSdk
|
|
@@ -102,7 +92,7 @@ const result = await totalumClient.crud.query('your_table_name');
|
|
|
102
92
|
|
|
103
93
|
```html
|
|
104
94
|
<head>
|
|
105
|
-
<script src="https://cdn.jsdelivr.net/npm/totalum-api-sdk@3.0.
|
|
95
|
+
<script src="https://cdn.jsdelivr.net/npm/totalum-api-sdk@3.0.7/dist/totalum-sdk.min.js"></script>
|
|
106
96
|
</head>
|
|
107
97
|
<script>
|
|
108
98
|
//Example of use TotalumSdk in your custom html page
|
|
@@ -719,7 +709,8 @@ if (result.errors) {
|
|
|
719
709
|
return;
|
|
720
710
|
}
|
|
721
711
|
|
|
722
|
-
|
|
712
|
+
// result.data is an array like ["https://..."], extract the URL:
|
|
713
|
+
const fileUrl = result.data[0];
|
|
723
714
|
console.log('Download URL:', fileUrl);
|
|
724
715
|
|
|
725
716
|
```
|
|
@@ -25,11 +25,11 @@ export declare class FilesService {
|
|
|
25
25
|
* @param {string} fileName - The name of the file
|
|
26
26
|
* @param {object} options - Optional configuration
|
|
27
27
|
* @param {number} options.expirationTime - Expiration time in milliseconds (default: 128 hours)
|
|
28
|
-
* @returns {Promise<TotalumApiResponse<string>>} - The download URL
|
|
28
|
+
* @returns {Promise<TotalumApiResponse<string[]>>} - The download URL wrapped in an array, extract with result.data[0]
|
|
29
29
|
*/
|
|
30
30
|
getDownloadUrl(fileName: string, options?: {
|
|
31
31
|
expirationTime?: number;
|
|
32
|
-
}): Promise<TotalumApiResponse<string>>;
|
|
32
|
+
}): Promise<TotalumApiResponse<string[]>>;
|
|
33
33
|
/**
|
|
34
34
|
* Generates a PDF from a template.
|
|
35
35
|
* @param {string} id - Template ID
|
|
@@ -47,7 +47,7 @@ class FilesService {
|
|
|
47
47
|
* @param {string} fileName - The name of the file
|
|
48
48
|
* @param {object} options - Optional configuration
|
|
49
49
|
* @param {number} options.expirationTime - Expiration time in milliseconds (default: 128 hours)
|
|
50
|
-
* @returns {Promise<TotalumApiResponse<string>>} - The download URL
|
|
50
|
+
* @returns {Promise<TotalumApiResponse<string[]>>} - The download URL wrapped in an array, extract with result.data[0]
|
|
51
51
|
*/
|
|
52
52
|
getDownloadUrl(fileName, options) {
|
|
53
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -67,14 +67,6 @@ export interface SearchAndExtractRequestBody {
|
|
|
67
67
|
include_raw_content?: boolean;
|
|
68
68
|
format?: 'text' | 'markdown' | 'clean_html';
|
|
69
69
|
}
|
|
70
|
-
export interface ScrapflyMeta {
|
|
71
|
-
cost: number;
|
|
72
|
-
remaining_credits: number;
|
|
73
|
-
concurrent_usage: number;
|
|
74
|
-
remaining_concurrent: number;
|
|
75
|
-
project_concurrent_usage: number;
|
|
76
|
-
project_remaining_concurrent: number;
|
|
77
|
-
}
|
|
78
70
|
export interface ScrapeResponseData {
|
|
79
71
|
url: string;
|
|
80
72
|
status_code: number;
|
|
@@ -83,7 +75,6 @@ export interface ScrapeResponseData {
|
|
|
83
75
|
headers: Record<string, string>;
|
|
84
76
|
format: string;
|
|
85
77
|
extracted_data?: any;
|
|
86
|
-
scrapfly: ScrapflyMeta;
|
|
87
78
|
}
|
|
88
79
|
export interface ExtractResponseData {
|
|
89
80
|
content_type: string;
|
|
@@ -94,13 +85,11 @@ export interface ExtractResponseData {
|
|
|
94
85
|
fulfillment_percent: number;
|
|
95
86
|
};
|
|
96
87
|
url?: string;
|
|
97
|
-
scrapfly: ScrapflyMeta;
|
|
98
88
|
}
|
|
99
89
|
export interface ScreenshotResponseData {
|
|
100
90
|
url: string;
|
|
101
91
|
screenshot_binary: string;
|
|
102
92
|
format: string;
|
|
103
|
-
scrapfly: ScrapflyMeta;
|
|
104
93
|
}
|
|
105
94
|
export interface SearchAndExtractResult {
|
|
106
95
|
position: number;
|