@emilgroup/translation-sdk 1.1.0 → 1.1.1-beta.10

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,6 +3,7 @@
3
3
  .openapi-generator-ignore
4
4
  README.md
5
5
  api.ts
6
+ api/default-api.ts
6
7
  api/translation-api.ts
7
8
  base.ts
8
9
  common.ts
@@ -13,6 +14,8 @@ models/create-product-language-request-dto.ts
13
14
  models/create-product-language-response-class.ts
14
15
  models/get-product-language-response-class.ts
15
16
  models/index.ts
17
+ models/inline-response200.ts
18
+ models/inline-response503.ts
16
19
  models/list-product-languages-response-class.ts
17
20
  models/list-translations-response-class.ts
18
21
  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 Node module can be used with Nodejs based applications.
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).
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.1.0 --save
20
+ npm install @emilgroup/translation-sdk@1.1.1-beta.10 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/translation-sdk@1.1.0
24
+ yarn add @emilgroup/translation-sdk@1.1.1-beta.10
25
25
  ```
26
26
 
27
27
  And then you can import `TranslationApi`.
@@ -29,36 +29,19 @@ And then you can import `TranslationApi`.
29
29
  ```ts
30
30
  import { TranslationApi } from '@emilgroup/translation-sdk'
31
31
 
32
- const tranlationApi = new TranslationApi();
32
+ const translationApi = new TranslationApi();
33
33
  ```
34
- ## Credentials
35
34
 
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:
35
+ To use authentication protected endpoints, you have to first authorize. To do so, use the `authorize` function in `TranslationApi`:
53
36
 
54
37
  ```ts
55
- async function listProductLanguages(): Promise<Void> {
38
+ async function listTranslations(): Promise<Void> {
56
39
  try {
57
- const tranlationApi = new TranslationApi();
40
+ const translationApi = new TranslationApi();
58
41
 
59
- await tranlationApi.initialize(); // should be called only once per Api.
42
+ await translationApi.authorize('username', 'password');
60
43
 
61
- const { data: { items } } = await tranlationApi.listProductLanguages();
44
+ const { data: { items } } = await translationApi.listTranslations();
62
45
 
63
46
  console.log(items);
64
47
  } catch(error) {
@@ -0,0 +1,124 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL TranslationService
5
+ * The EMIL TranslationService API description
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ * Contact: kontakt@emil.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
17
+ import { Configuration } from '../configuration';
18
+ // Some imports not used depending on template conditions
19
+ // @ts-ignore
20
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
21
+ // @ts-ignore
22
+ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
23
+ // @ts-ignore
24
+ import { InlineResponse200 } from '../models';
25
+ // @ts-ignore
26
+ import { InlineResponse503 } from '../models';
27
+ /**
28
+ * DefaultApi - axios parameter creator
29
+ * @export
30
+ */
31
+ export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
32
+ return {
33
+ /**
34
+ * Returns the health status of the translation service. This endpoint is used to monitor the operational status of the translation service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
35
+ * @summary Health Check
36
+ * @param {*} [options] Override http request option.
37
+ * @throws {RequiredError}
38
+ */
39
+ check: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
40
+ const localVarPath = `/translationservice/health`;
41
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
42
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
43
+ let baseOptions;
44
+ let baseAccessToken;
45
+ if (configuration) {
46
+ baseOptions = configuration.baseOptions;
47
+ baseAccessToken = configuration.accessToken;
48
+ }
49
+
50
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
51
+ const localVarHeaderParameter = {} as any;
52
+ const localVarQueryParameter = {} as any;
53
+
54
+
55
+
56
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
57
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
58
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
59
+
60
+ return {
61
+ url: toPathString(localVarUrlObj),
62
+ options: localVarRequestOptions,
63
+ };
64
+ },
65
+ }
66
+ };
67
+
68
+ /**
69
+ * DefaultApi - functional programming interface
70
+ * @export
71
+ */
72
+ export const DefaultApiFp = function(configuration?: Configuration) {
73
+ const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
74
+ return {
75
+ /**
76
+ * Returns the health status of the translation service. This endpoint is used to monitor the operational status of the translation service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
77
+ * @summary Health Check
78
+ * @param {*} [options] Override http request option.
79
+ * @throws {RequiredError}
80
+ */
81
+ async check(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponse200>> {
82
+ const localVarAxiosArgs = await localVarAxiosParamCreator.check(options);
83
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
84
+ },
85
+ }
86
+ };
87
+
88
+ /**
89
+ * DefaultApi - factory interface
90
+ * @export
91
+ */
92
+ export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
93
+ const localVarFp = DefaultApiFp(configuration)
94
+ return {
95
+ /**
96
+ * Returns the health status of the translation service. This endpoint is used to monitor the operational status of the translation service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
97
+ * @summary Health Check
98
+ * @param {*} [options] Override http request option.
99
+ * @throws {RequiredError}
100
+ */
101
+ check(options?: any): AxiosPromise<InlineResponse200> {
102
+ return localVarFp.check(options).then((request) => request(axios, basePath));
103
+ },
104
+ };
105
+ };
106
+
107
+ /**
108
+ * DefaultApi - object-oriented interface
109
+ * @export
110
+ * @class DefaultApi
111
+ * @extends {BaseAPI}
112
+ */
113
+ export class DefaultApi extends BaseAPI {
114
+ /**
115
+ * Returns the health status of the translation service. This endpoint is used to monitor the operational status of the translation service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
116
+ * @summary Health Check
117
+ * @param {*} [options] Override http request option.
118
+ * @throws {RequiredError}
119
+ * @memberof DefaultApi
120
+ */
121
+ public check(options?: AxiosRequestConfig) {
122
+ return DefaultApiFp(this.configuration).check(options).then((request) => request(this.axios, this.basePath));
123
+ }
124
+ }