@emilgroup/translation-sdk-node 1.1.0 → 1.1.1-beta.5

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
@@ -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-node@1.1.0 --save
20
+ npm install @emilgroup/translation-sdk-node@1.1.1-beta.5 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/translation-sdk-node@1.1.0
24
+ yarn add @emilgroup/translation-sdk-node@1.1.1-beta.5
25
25
  ```
26
26
 
27
27
  And then you can import `TranslationApi`.
@@ -47,18 +47,34 @@ export EMIL_USERNAME=XXXXX@XXXX.XXX
47
47
  export EMIL_PASSWORD=XXXXXXXXXXXXXX
48
48
  ```
49
49
 
50
+ ## Base path
51
+
52
+ To select the basic path for using the API, we can use two approaches. The first is to use one of the predefined environments, and the second is to specify the domain as a string.
53
+
54
+ ```ts
55
+ import { TranslationApi, Environment } from '@emilgroup/translation-sdk-node'
56
+
57
+ const translationApi = new TranslationApi();
58
+
59
+ // Allows you to simply choose environment. It will usually be Environment.Production.
60
+ translationApi.selectEnvironment(Environment.Production);
61
+
62
+ // For advanced users, use the custom baseUrl of the website you need to connect to.
63
+ translationApi.selectBasePath('https://my-custom-domain.com');
64
+ ```
65
+
50
66
  ## Example
51
67
 
52
68
  Here is a basic functionning example:
53
69
 
54
70
  ```ts
55
- async function listProductLanguages(): Promise<Void> {
71
+ async function listTranslations(): Promise<Void> {
56
72
  try {
57
73
  const translationApi = new TranslationApi();
58
74
 
59
75
  await translationApi.initialize(); // should be called only once per Api.
60
76
 
61
- const { data: { items } } = await translationApi.listProductLanguages();
77
+ const { data: { items } } = await translationApi.listTranslations();
62
78
 
63
79
  console.log(items);
64
80
  } catch(error) {
@@ -0,0 +1,128 @@
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
+ // URLSearchParams not necessarily used
28
+ // @ts-ignore
29
+ import { URL, URLSearchParams } from 'url';
30
+ const FormData = require('form-data');
31
+ /**
32
+ * DefaultApi - axios parameter creator
33
+ * @export
34
+ */
35
+ export const DefaultApiAxiosParamCreator = function (configuration?: Configuration) {
36
+ return {
37
+ /**
38
+ * 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.
39
+ * @summary Health Check
40
+ * @param {*} [options] Override http request option.
41
+ * @throws {RequiredError}
42
+ */
43
+ check: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
44
+ const localVarPath = `/translationservice/health`;
45
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
46
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
47
+ let baseOptions;
48
+ let baseAccessToken;
49
+ if (configuration) {
50
+ baseOptions = configuration.baseOptions;
51
+ baseAccessToken = configuration.accessToken;
52
+ }
53
+
54
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
55
+ const localVarHeaderParameter = {} as any;
56
+ const localVarQueryParameter = {} as any;
57
+
58
+
59
+
60
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
61
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
62
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
63
+
64
+ return {
65
+ url: toPathString(localVarUrlObj),
66
+ options: localVarRequestOptions,
67
+ };
68
+ },
69
+ }
70
+ };
71
+
72
+ /**
73
+ * DefaultApi - functional programming interface
74
+ * @export
75
+ */
76
+ export const DefaultApiFp = function(configuration?: Configuration) {
77
+ const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration)
78
+ return {
79
+ /**
80
+ * 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.
81
+ * @summary Health Check
82
+ * @param {*} [options] Override http request option.
83
+ * @throws {RequiredError}
84
+ */
85
+ async check(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponse200>> {
86
+ const localVarAxiosArgs = await localVarAxiosParamCreator.check(options);
87
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
88
+ },
89
+ }
90
+ };
91
+
92
+ /**
93
+ * DefaultApi - factory interface
94
+ * @export
95
+ */
96
+ export const DefaultApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
97
+ const localVarFp = DefaultApiFp(configuration)
98
+ return {
99
+ /**
100
+ * 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.
101
+ * @summary Health Check
102
+ * @param {*} [options] Override http request option.
103
+ * @throws {RequiredError}
104
+ */
105
+ check(options?: any): AxiosPromise<InlineResponse200> {
106
+ return localVarFp.check(options).then((request) => request(axios, basePath));
107
+ },
108
+ };
109
+ };
110
+
111
+ /**
112
+ * DefaultApi - object-oriented interface
113
+ * @export
114
+ * @class DefaultApi
115
+ * @extends {BaseAPI}
116
+ */
117
+ export class DefaultApi extends BaseAPI {
118
+ /**
119
+ * 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.
120
+ * @summary Health Check
121
+ * @param {*} [options] Override http request option.
122
+ * @throws {RequiredError}
123
+ * @memberof DefaultApi
124
+ */
125
+ public check(options?: AxiosRequestConfig) {
126
+ return DefaultApiFp(this.configuration).check(options).then((request) => request(this.axios, this.basePath));
127
+ }
128
+ }