totalum-api-sdk 2.0.9 → 2.0.11

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
@@ -9,59 +9,83 @@ This library wraps the totalum public api, so you can easy call all endpoints.
9
9
  npm i totalum-api-sdk
10
10
  ```
11
11
 
12
- We recomend you to use the api key instead of the token.
13
12
 
14
- ```javascript
13
+ # Usage of TotalumApiSdk
14
+
15
+ Totalum allows you to use the SDK to perform actions such as creating users, creating items, creating pdfs, etc.
16
+
17
+ Basically the Totalum sdk is a wrapper of the Totalum api, so if you want you can use the api directly if you prefer.
18
+
19
+
20
+ ## Authentication
21
+
22
+ You can choose to use one of the two authentication methods offered by Totalum Sdk:
23
+
24
+ - **Token**: You can use an access token to authenticate. This token can be obtained from the localStorage of your browser from the web https://web.totalum.app
25
+
26
+ - **ApiKey**: (RECOMMENDED OPTION) You can use an ApiKey to authenticate. This ApiKey can be obtained in the **Api Keys** section of the **Configuration** section of Totalum.
27
+
28
+ **In Typescript:**
29
+
30
+ ```typescript
31
+
15
32
  // IN TYPESCRIPT
16
33
 
17
34
  import {AuthOptions, TotalumApiSdk} from 'totalum-api-sdk';
18
35
 
36
+ // CHOISE FROM USE accessToken OR apiKey (API KEY IS RECOMMENDED)
37
+
19
38
  // the auth using token
20
39
  const options: AuthOptions = {
21
40
  token:{
22
- accessToken: 'YOUR TOKEN'
41
+ accessToken: 'YOUR TOKEN' // get it from totalum project web localStorage
23
42
  }
24
43
  }
25
44
 
26
45
  // the auth using api key
27
46
  const options: AuthOptions = {
28
47
  apiKey:{
29
- 'api-key': 'your_api_key',
30
- 'api-key-name': 'your_api_key_name',
31
- 'organization-id': 'your_organization_id'
48
+ 'api-key': 'your_api_key', //the api key secret that is shown only once
49
+ 'api-key-name': 'your_api_key_name', // the name of the api key that you can see in the api keys section
50
+ 'organization-id': 'your_organization_id' // your project name (project id) Get it from Configuration -> Información Proyecto -> Nombre del proyecto (project id)
32
51
  }
33
52
  }
34
53
 
35
54
  const totalumClient = new TotalumApiSdk(options);
36
55
 
37
- // execute some function
38
-
56
+ // execute some TotalumApiSdk function
39
57
  const result = await totalumClient.crud.getItems('your_item', {});
58
+
40
59
  ```
41
60
 
61
+ **In Javascript:**
62
+
42
63
  ```javascript
43
64
  // IN JAVASCRIPT
44
65
 
45
66
  const totalum = require('totalum-api-sdk');
46
67
 
68
+ // CHOICE FROM USE accessToken OR apiKey (API KEY IS RECOMMENDED)
69
+
47
70
  // the auth using token
48
71
  const options = {
49
72
  token:{
50
- accessToken: 'YOUR TOKEN'
73
+ accessToken: 'YOUR TOKEN' // get it from totalum project web localStorage
51
74
  }
52
75
  }
53
76
 
54
77
  // the auth using api key
55
78
  const options: AuthOptions = {
56
79
  apiKey:{
57
- 'api-key': 'your_api_key',
58
- 'api-key-name': 'your_api_key_name',
59
- 'organization-id': 'your_organization_id'
80
+ 'api-key': 'your_api_key', //the api key secret that is shown only once
81
+ 'api-key-name': 'your_api_key_name', // the name of the api key that you can see in the api keys section
82
+ 'organization-id': 'your_organization_id' // your project name (project id) Get it from Configuration -> Información Proyecto -> Nombre del proyecto (project id)
60
83
  }
61
84
  }
62
85
 
63
86
  const totalumClient = new totalum.TotalumApiSdk(options);
64
87
 
88
+ // execute some TotalumApiSdk function
65
89
  const result = await totalumClient.crud.getItems('your_item', {});
66
-
90
+
67
91
  ```
@@ -103,7 +103,7 @@ export interface StructureLevels {
103
103
  }
104
104
  export interface FilterSearchQueryI {
105
105
  filter?: FiltersArrayI;
106
- sort?: ISearchQuerySort[];
106
+ sort?: ISearchQuerySort;
107
107
  pagination?: {
108
108
  limit?: number;
109
109
  page?: number;
@@ -3,7 +3,15 @@ export declare class FilesService {
3
3
  private baseUrl;
4
4
  constructor(baseUrl: string, headers: any);
5
5
  uploadFile(fileFormData: any): Promise<import("axios").AxiosResponse<any, any>>;
6
- getDownloadUrl(fileName: string): Promise<import("axios").AxiosResponse<any, any>>;
6
+ /**
7
+ *
8
+ * @param fileName
9
+ * @param options options.expirationTime - is the time in milliseconds that the signed URL should be valid for. The default is 128 hours
10
+ * @returns
11
+ */
12
+ getDownloadUrl(fileName: string, options: {
13
+ expirationTime: number;
14
+ }): Promise<import("axios").AxiosResponse<any, any>>;
7
15
  generatePdfByTemplate(id: string, variables: {
8
16
  [variableName: string]: any;
9
17
  }, name: string): Promise<import("axios").AxiosResponse<any, any>>;
@@ -27,10 +27,16 @@ class FilesService {
27
27
  return axios_1.default.post(url, fileFormData, { headers: this.headers });
28
28
  });
29
29
  }
30
- getDownloadUrl(fileName) {
30
+ /**
31
+ *
32
+ * @param fileName
33
+ * @param options options.expirationTime - is the time in milliseconds that the signed URL should be valid for. The default is 128 hours
34
+ * @returns
35
+ */
36
+ getDownloadUrl(fileName, options) {
31
37
  return __awaiter(this, void 0, void 0, function* () {
32
38
  const url = utils_1.UtilsService.getUrl(this.baseUrl, endpoints_1.endpoints.files.getDownloadUrl, { fileName });
33
- return axios_1.default.get(url, { headers: this.headers });
39
+ return axios_1.default.get(url, { headers: this.headers, params: options });
34
40
  });
35
41
  }
36
42
  generatePdfByTemplate(id, variables, name) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "totalum-api-sdk",
3
- "version": "2.0.9",
4
- "description": "Totalum sdk wraper of totalum api",
3
+ "version": "2.0.11",
4
+ "description": "Totalum sdk wrapper and utils of totalum api",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "files": ["dist"],