@emilgroup/translation-sdk 1.0.1-beta.4 → 1.1.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.
@@ -3,7 +3,6 @@
3
3
  .openapi-generator-ignore
4
4
  README.md
5
5
  api.ts
6
- api/default-api.ts
7
6
  api/translation-api.ts
8
7
  base.ts
9
8
  common.ts
@@ -14,8 +13,6 @@ models/create-product-language-request-dto.ts
14
13
  models/create-product-language-response-class.ts
15
14
  models/get-product-language-response-class.ts
16
15
  models/index.ts
17
- models/inline-response200.ts
18
- models/inline-response503.ts
19
16
  models/list-product-languages-response-class.ts
20
17
  models/list-translations-response-class.ts
21
18
  models/product-language-class.ts
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Emil Translation SDK
2
2
 
3
- This TypeScript/JavaScript client utilizes [axios](https://github.com/axios/axios). The generated module can be used with client-based applications (i.e. React).
3
+ This TypeScript/JavaScript client utilizes [axios](https://github.com/axios/axios). The generated Node module can be used with Nodejs based applications.
4
4
 
5
5
  Language level
6
6
  * ES5 - you must have a Promises/A+ library installed
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
17
17
  Navigate to the folder of your consuming project and run one of the following commands:
18
18
 
19
19
  ```
20
- npm install @emilgroup/translation-sdk@1.0.1-beta.4 --save
20
+ npm install @emilgroup/translation-sdk@1.1.0 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/translation-sdk@1.0.1-beta.4
24
+ yarn add @emilgroup/translation-sdk@1.1.0
25
25
  ```
26
26
 
27
27
  And then you can import `TranslationApi`.
@@ -29,19 +29,36 @@ And then you can import `TranslationApi`.
29
29
  ```ts
30
30
  import { TranslationApi } from '@emilgroup/translation-sdk'
31
31
 
32
- const translationApi = new TranslationApi();
32
+ const tranlationApi = new TranslationApi();
33
33
  ```
34
+ ## Credentials
34
35
 
35
- To use authentication protected endpoints, you have to first authorize. To do so, use the `authorize` function in `TranslationApi`:
36
+ To use authentication protected endpoints, you have to first authorize. To do so, the easiest way is to provide a configuration file under `~/.emil/credentials` with the following content:
37
+
38
+ ```shell
39
+ emil_username=XXXXX@XXXX.XXX
40
+ emil_password=XXXXXXXXXXXXXX
41
+ ```
42
+
43
+ It is also possible to provide environment variables instead:
44
+
45
+ ```shell
46
+ export EMIL_USERNAME=XXXXX@XXXX.XXX
47
+ export EMIL_PASSWORD=XXXXXXXXXXXXXX
48
+ ```
49
+
50
+ ## Example
51
+
52
+ Here is a basic functionning example:
36
53
 
37
54
  ```ts
38
- async function listTranslations(): Promise<Void> {
55
+ async function listProductLanguages(): Promise<Void> {
39
56
  try {
40
- const translationApi = new TranslationApi();
57
+ const tranlationApi = new TranslationApi();
41
58
 
42
- await translationApi.authorize('username', 'password');
59
+ await tranlationApi.initialize(); // should be called only once per Api.
43
60
 
44
- const { data: { items } } = await translationApi.listTranslations();
61
+ const { data: { items } } = await tranlationApi.listProductLanguages();
45
62
 
46
63
  console.log(items);
47
64
  } catch(error) {