@tradecafe/offer-service-sdk 0.0.1

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/api.ts ADDED
@@ -0,0 +1,3 @@
1
+ // This is the entrypoint for the package
2
+ export * from './api/apis';
3
+ export * from './model/models';
package/git_push.sh ADDED
@@ -0,0 +1,57 @@
1
+ #!/bin/sh
2
+ # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3
+ #
4
+ # Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
5
+
6
+ git_user_id=$1
7
+ git_repo_id=$2
8
+ release_note=$3
9
+ git_host=$4
10
+
11
+ if [ "$git_host" = "" ]; then
12
+ git_host="github.com"
13
+ echo "[INFO] No command line input provided. Set \$git_host to $git_host"
14
+ fi
15
+
16
+ if [ "$git_user_id" = "" ]; then
17
+ git_user_id="GIT_USER_ID"
18
+ echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
19
+ fi
20
+
21
+ if [ "$git_repo_id" = "" ]; then
22
+ git_repo_id="GIT_REPO_ID"
23
+ echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
24
+ fi
25
+
26
+ if [ "$release_note" = "" ]; then
27
+ release_note="Minor update"
28
+ echo "[INFO] No command line input provided. Set \$release_note to $release_note"
29
+ fi
30
+
31
+ # Initialize the local directory as a Git repository
32
+ git init
33
+
34
+ # Adds the files in the local repository and stages them for commit.
35
+ git add .
36
+
37
+ # Commits the tracked changes and prepares them to be pushed to a remote repository.
38
+ git commit -m "$release_note"
39
+
40
+ # Sets the new remote
41
+ git_remote=$(git remote)
42
+ if [ "$git_remote" = "" ]; then # git remote not defined
43
+
44
+ if [ "$GIT_TOKEN" = "" ]; then
45
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
46
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
47
+ else
48
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
49
+ fi
50
+
51
+ fi
52
+
53
+ git pull origin master
54
+
55
+ # Pushes (Forces) the changes in the local repository up to the remote repository
56
+ echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
57
+ git push origin master 2>&1 | grep -v 'To https'
@@ -0,0 +1,50 @@
1
+ /**
2
+ * TradeCafé Offer Service
3
+ * Offer Service allows supplies to submit product offers into the TradeCafe platform
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+ import { RequestFile } from './models';
14
+ import { HealthControllerPing200ResponseInfoValue } from './healthControllerPing200ResponseInfoValue';
15
+
16
+ export class HealthControllerPing200Response {
17
+ 'status'?: string;
18
+ 'info'?: { [key: string]: HealthControllerPing200ResponseInfoValue; } | null;
19
+ 'error'?: { [key: string]: HealthControllerPing200ResponseInfoValue; } | null;
20
+ 'details'?: { [key: string]: HealthControllerPing200ResponseInfoValue; };
21
+
22
+ static discriminator: string | undefined = undefined;
23
+
24
+ static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
25
+ {
26
+ "name": "status",
27
+ "baseName": "status",
28
+ "type": "string"
29
+ },
30
+ {
31
+ "name": "info",
32
+ "baseName": "info",
33
+ "type": "{ [key: string]: HealthControllerPing200ResponseInfoValue; }"
34
+ },
35
+ {
36
+ "name": "error",
37
+ "baseName": "error",
38
+ "type": "{ [key: string]: HealthControllerPing200ResponseInfoValue; }"
39
+ },
40
+ {
41
+ "name": "details",
42
+ "baseName": "details",
43
+ "type": "{ [key: string]: HealthControllerPing200ResponseInfoValue; }"
44
+ } ];
45
+
46
+ static getAttributeTypeMap() {
47
+ return HealthControllerPing200Response.attributeTypeMap;
48
+ }
49
+ }
50
+
@@ -0,0 +1,31 @@
1
+ /**
2
+ * TradeCafé Offer Service
3
+ * Offer Service allows supplies to submit product offers into the TradeCafe platform
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+ import { RequestFile } from './models';
14
+
15
+ export class HealthControllerPing200ResponseInfoValue extends null<String, string> {
16
+ 'status'?: string;
17
+
18
+ static discriminator: string | undefined = undefined;
19
+
20
+ static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
21
+ {
22
+ "name": "status",
23
+ "baseName": "status",
24
+ "type": "string"
25
+ } ];
26
+
27
+ static getAttributeTypeMap() {
28
+ return super.getAttributeTypeMap().concat(HealthControllerPing200ResponseInfoValue.attributeTypeMap);
29
+ }
30
+ }
31
+
@@ -0,0 +1,50 @@
1
+ /**
2
+ * TradeCafé Offer Service
3
+ * Offer Service allows supplies to submit product offers into the TradeCafe platform
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+ import { RequestFile } from './models';
14
+ import { HealthControllerPing200ResponseInfoValue } from './healthControllerPing200ResponseInfoValue';
15
+
16
+ export class HealthControllerPing503Response {
17
+ 'status'?: string;
18
+ 'info'?: { [key: string]: HealthControllerPing200ResponseInfoValue; } | null;
19
+ 'error'?: { [key: string]: HealthControllerPing200ResponseInfoValue; } | null;
20
+ 'details'?: { [key: string]: HealthControllerPing200ResponseInfoValue; };
21
+
22
+ static discriminator: string | undefined = undefined;
23
+
24
+ static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
25
+ {
26
+ "name": "status",
27
+ "baseName": "status",
28
+ "type": "string"
29
+ },
30
+ {
31
+ "name": "info",
32
+ "baseName": "info",
33
+ "type": "{ [key: string]: HealthControllerPing200ResponseInfoValue; }"
34
+ },
35
+ {
36
+ "name": "error",
37
+ "baseName": "error",
38
+ "type": "{ [key: string]: HealthControllerPing200ResponseInfoValue; }"
39
+ },
40
+ {
41
+ "name": "details",
42
+ "baseName": "details",
43
+ "type": "{ [key: string]: HealthControllerPing200ResponseInfoValue; }"
44
+ } ];
45
+
46
+ static getAttributeTypeMap() {
47
+ return HealthControllerPing503Response.attributeTypeMap;
48
+ }
49
+ }
50
+
@@ -0,0 +1,228 @@
1
+ import localVarRequest from 'request';
2
+
3
+ export * from './healthControllerPing200Response';
4
+ export * from './healthControllerPing200ResponseInfoValue';
5
+ export * from './healthControllerPing503Response';
6
+
7
+ import * as fs from 'fs';
8
+
9
+ export interface RequestDetailedFile {
10
+ value: Buffer;
11
+ options?: {
12
+ filename?: string;
13
+ contentType?: string;
14
+ }
15
+ }
16
+
17
+ export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile;
18
+
19
+
20
+ import { HealthControllerPing200Response } from './healthControllerPing200Response';
21
+ import { HealthControllerPing200ResponseInfoValue } from './healthControllerPing200ResponseInfoValue';
22
+ import { HealthControllerPing503Response } from './healthControllerPing503Response';
23
+
24
+ /* tslint:disable:no-unused-variable */
25
+ let primitives = [
26
+ "string",
27
+ "boolean",
28
+ "double",
29
+ "integer",
30
+ "long",
31
+ "float",
32
+ "number",
33
+ "any"
34
+ ];
35
+
36
+ let enumsMap: {[index: string]: any} = {
37
+ }
38
+
39
+ let typeMap: {[index: string]: any} = {
40
+ "HealthControllerPing200Response": HealthControllerPing200Response,
41
+ "HealthControllerPing200ResponseInfoValue": HealthControllerPing200ResponseInfoValue,
42
+ "HealthControllerPing503Response": HealthControllerPing503Response,
43
+ }
44
+
45
+ export class ObjectSerializer {
46
+ public static findCorrectType(data: any, expectedType: string) {
47
+ if (data == undefined) {
48
+ return expectedType;
49
+ } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) {
50
+ return expectedType;
51
+ } else if (expectedType === "Date") {
52
+ return expectedType;
53
+ } else {
54
+ if (enumsMap[expectedType]) {
55
+ return expectedType;
56
+ }
57
+
58
+ if (!typeMap[expectedType]) {
59
+ return expectedType; // w/e we don't know the type
60
+ }
61
+
62
+ // Check the discriminator
63
+ let discriminatorProperty = typeMap[expectedType].discriminator;
64
+ if (discriminatorProperty == null) {
65
+ return expectedType; // the type does not have a discriminator. use it.
66
+ } else {
67
+ if (data[discriminatorProperty]) {
68
+ var discriminatorType = data[discriminatorProperty];
69
+ if(typeMap[discriminatorType]){
70
+ return discriminatorType; // use the type given in the discriminator
71
+ } else {
72
+ return expectedType; // discriminator did not map to a type
73
+ }
74
+ } else {
75
+ return expectedType; // discriminator was not present (or an empty string)
76
+ }
77
+ }
78
+ }
79
+ }
80
+
81
+ public static serialize(data: any, type: string) {
82
+ if (data == undefined) {
83
+ return data;
84
+ } else if (primitives.indexOf(type.toLowerCase()) !== -1) {
85
+ return data;
86
+ } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
87
+ let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
88
+ subType = subType.substring(0, subType.length - 1); // Type> => Type
89
+ let transformedData: any[] = [];
90
+ for (let index = 0; index < data.length; index++) {
91
+ let datum = data[index];
92
+ transformedData.push(ObjectSerializer.serialize(datum, subType));
93
+ }
94
+ return transformedData;
95
+ } else if (type === "Date") {
96
+ return data.toISOString();
97
+ } else {
98
+ if (enumsMap[type]) {
99
+ return data;
100
+ }
101
+ if (!typeMap[type]) { // in case we dont know the type
102
+ return data;
103
+ }
104
+
105
+ // Get the actual type of this object
106
+ type = this.findCorrectType(data, type);
107
+
108
+ // get the map for the correct type.
109
+ let attributeTypes = typeMap[type].getAttributeTypeMap();
110
+ let instance: {[index: string]: any} = {};
111
+ for (let index = 0; index < attributeTypes.length; index++) {
112
+ let attributeType = attributeTypes[index];
113
+ instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
114
+ }
115
+ return instance;
116
+ }
117
+ }
118
+
119
+ public static deserialize(data: any, type: string) {
120
+ // polymorphism may change the actual type.
121
+ type = ObjectSerializer.findCorrectType(data, type);
122
+ if (data == undefined) {
123
+ return data;
124
+ } else if (primitives.indexOf(type.toLowerCase()) !== -1) {
125
+ return data;
126
+ } else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
127
+ let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
128
+ subType = subType.substring(0, subType.length - 1); // Type> => Type
129
+ let transformedData: any[] = [];
130
+ for (let index = 0; index < data.length; index++) {
131
+ let datum = data[index];
132
+ transformedData.push(ObjectSerializer.deserialize(datum, subType));
133
+ }
134
+ return transformedData;
135
+ } else if (type === "Date") {
136
+ return new Date(data);
137
+ } else {
138
+ if (enumsMap[type]) {// is Enum
139
+ return data;
140
+ }
141
+
142
+ if (!typeMap[type]) { // dont know the type
143
+ return data;
144
+ }
145
+ let instance = new typeMap[type]();
146
+ let attributeTypes = typeMap[type].getAttributeTypeMap();
147
+ for (let index = 0; index < attributeTypes.length; index++) {
148
+ let attributeType = attributeTypes[index];
149
+ instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type);
150
+ }
151
+ return instance;
152
+ }
153
+ }
154
+ }
155
+
156
+ export interface Authentication {
157
+ /**
158
+ * Apply authentication settings to header and query params.
159
+ */
160
+ applyToRequest(requestOptions: localVarRequest.Options): Promise<void> | void;
161
+ }
162
+
163
+ export class HttpBasicAuth implements Authentication {
164
+ public username: string = '';
165
+ public password: string = '';
166
+
167
+ applyToRequest(requestOptions: localVarRequest.Options): void {
168
+ requestOptions.auth = {
169
+ username: this.username, password: this.password
170
+ }
171
+ }
172
+ }
173
+
174
+ export class HttpBearerAuth implements Authentication {
175
+ public accessToken: string | (() => string) = '';
176
+
177
+ applyToRequest(requestOptions: localVarRequest.Options): void {
178
+ if (requestOptions && requestOptions.headers) {
179
+ const accessToken = typeof this.accessToken === 'function'
180
+ ? this.accessToken()
181
+ : this.accessToken;
182
+ requestOptions.headers["Authorization"] = "Bearer " + accessToken;
183
+ }
184
+ }
185
+ }
186
+
187
+ export class ApiKeyAuth implements Authentication {
188
+ public apiKey: string = '';
189
+
190
+ constructor(private location: string, private paramName: string) {
191
+ }
192
+
193
+ applyToRequest(requestOptions: localVarRequest.Options): void {
194
+ if (this.location == "query") {
195
+ (<any>requestOptions.qs)[this.paramName] = this.apiKey;
196
+ } else if (this.location == "header" && requestOptions && requestOptions.headers) {
197
+ requestOptions.headers[this.paramName] = this.apiKey;
198
+ } else if (this.location == 'cookie' && requestOptions && requestOptions.headers) {
199
+ if (requestOptions.headers['Cookie']) {
200
+ requestOptions.headers['Cookie'] += '; ' + this.paramName + '=' + encodeURIComponent(this.apiKey);
201
+ }
202
+ else {
203
+ requestOptions.headers['Cookie'] = this.paramName + '=' + encodeURIComponent(this.apiKey);
204
+ }
205
+ }
206
+ }
207
+ }
208
+
209
+ export class OAuth implements Authentication {
210
+ public accessToken: string = '';
211
+
212
+ applyToRequest(requestOptions: localVarRequest.Options): void {
213
+ if (requestOptions && requestOptions.headers) {
214
+ requestOptions.headers["Authorization"] = "Bearer " + this.accessToken;
215
+ }
216
+ }
217
+ }
218
+
219
+ export class VoidAuth implements Authentication {
220
+ public username: string = '';
221
+ public password: string = '';
222
+
223
+ applyToRequest(_: localVarRequest.Options): void {
224
+ // Do nothing
225
+ }
226
+ }
227
+
228
+ export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise<void> | void);
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@tradecafe/offer-service-sdk",
3
+ "version": "0.0.1",
4
+ "description": "NodeJS client for @tradecafe/offer-service-sdk",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
8
+ },
9
+ "main": "dist/api.js",
10
+ "types": "dist/api.d.ts",
11
+ "scripts": {
12
+ "clean": "rm -Rf node_modules/ *.js",
13
+ "build": "tsc",
14
+ "test": "npm run build && node dist/client.js"
15
+ },
16
+ "author": "OpenAPI-Generator Contributors",
17
+ "license": "Unlicense",
18
+ "dependencies": {
19
+ "bluebird": "^3.5.0",
20
+ "request": "^2.81.0",
21
+ "rewire": "^3.0.2"
22
+ },
23
+ "devDependencies": {
24
+ "@types/bluebird": "^3.5.33",
25
+ "@types/node": "^12",
26
+ "@types/request": "^2.48.8",
27
+ "typescript": "^4.0"
28
+ }
29
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "noImplicitAny": false,
5
+ "suppressImplicitAnyIndexErrors": true,
6
+ "target": "ES5",
7
+ "allowSyntheticDefaultImports": true,
8
+ "esModuleInterop": true,
9
+ "strict": true,
10
+ "moduleResolution": "node",
11
+ "removeComments": true,
12
+ "sourceMap": true,
13
+ "noLib": false,
14
+ "declaration": true,
15
+ "lib": ["dom", "es6", "es5", "dom.iterable", "scripthost"],
16
+ "outDir": "dist",
17
+ "typeRoots": [
18
+ "node_modules/@types"
19
+ ]
20
+ },
21
+ "exclude": [
22
+ "dist",
23
+ "node_modules"
24
+ ]
25
+ }