asposeslidescloud 22.2.0 → 22.6.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.
- package/README.md +122 -87
- package/api.d.ts +3617 -3507
- package/api.js +12226 -11829
- package/internal/configuration.d.ts +44 -44
- package/internal/configuration.js +61 -60
- package/internal/objectSerializer.d.ts +18 -18
- package/internal/objectSerializer.js +185 -184
- package/internal/requestHelper.d.ts +33 -33
- package/internal/requestHelper.js +249 -247
- package/model.d.ts +7633 -6782
- package/model.js +4637 -4164
- package/package.json +24 -24
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slides API configuration
|
|
3
|
-
*/
|
|
4
|
-
export declare class Configuration {
|
|
5
|
-
/**
|
|
6
|
-
* Client ID.
|
|
7
|
-
*/
|
|
8
|
-
appSid: string;
|
|
9
|
-
/**
|
|
10
|
-
* Client Secret.
|
|
11
|
-
*/
|
|
12
|
-
appKey: string;
|
|
13
|
-
/**
|
|
14
|
-
* access token.
|
|
15
|
-
*/
|
|
16
|
-
accessToken: string;
|
|
17
|
-
/**
|
|
18
|
-
* Base Url.
|
|
19
|
-
*/
|
|
20
|
-
baseUrl: string;
|
|
21
|
-
/**
|
|
22
|
-
* Base Url.
|
|
23
|
-
*/
|
|
24
|
-
authBaseUrl: string;
|
|
25
|
-
/**
|
|
26
|
-
* Gets or sets slides operation timeout in seconds. 0 stands for no timeout. The timeout applies to the Slides operation, not to the HTTP request.
|
|
27
|
-
*/
|
|
28
|
-
timeout: number;
|
|
29
|
-
/**
|
|
30
|
-
* Gets or sets a value indicating whether debug mode. In debug mode all requests and responses are logged to console.
|
|
31
|
-
*/
|
|
32
|
-
debugMode: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Gets or sets collection of custom headers to be added to HTTP requests.
|
|
35
|
-
*/
|
|
36
|
-
customHeaders: {
|
|
37
|
-
[key: string]: string;
|
|
38
|
-
};
|
|
39
|
-
constructor(appSid: string, appKey: string, baseUrl?: string, authBaseUrl?: string, debugMode?: boolean, timeout?: number);
|
|
40
|
-
/**
|
|
41
|
-
* Returns api base url
|
|
42
|
-
*/
|
|
43
|
-
getApiBaseUrl(): string;
|
|
44
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Slides API configuration
|
|
3
|
+
*/
|
|
4
|
+
export declare class Configuration {
|
|
5
|
+
/**
|
|
6
|
+
* Client ID.
|
|
7
|
+
*/
|
|
8
|
+
appSid: string;
|
|
9
|
+
/**
|
|
10
|
+
* Client Secret.
|
|
11
|
+
*/
|
|
12
|
+
appKey: string;
|
|
13
|
+
/**
|
|
14
|
+
* access token.
|
|
15
|
+
*/
|
|
16
|
+
accessToken: string;
|
|
17
|
+
/**
|
|
18
|
+
* Base Url.
|
|
19
|
+
*/
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
/**
|
|
22
|
+
* Base Url.
|
|
23
|
+
*/
|
|
24
|
+
authBaseUrl: string;
|
|
25
|
+
/**
|
|
26
|
+
* Gets or sets slides operation timeout in seconds. 0 stands for no timeout. The timeout applies to the Slides operation, not to the HTTP request.
|
|
27
|
+
*/
|
|
28
|
+
timeout: number;
|
|
29
|
+
/**
|
|
30
|
+
* Gets or sets a value indicating whether debug mode. In debug mode all requests and responses are logged to console.
|
|
31
|
+
*/
|
|
32
|
+
debugMode: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Gets or sets collection of custom headers to be added to HTTP requests.
|
|
35
|
+
*/
|
|
36
|
+
customHeaders: {
|
|
37
|
+
[key: string]: string;
|
|
38
|
+
};
|
|
39
|
+
constructor(appSid: string, appKey: string, baseUrl?: string, authBaseUrl?: string, debugMode?: boolean, timeout?: number);
|
|
40
|
+
/**
|
|
41
|
+
* Returns api base url
|
|
42
|
+
*/
|
|
43
|
+
getApiBaseUrl(): string;
|
|
44
|
+
}
|
|
@@ -1,60 +1,61 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* MIT License
|
|
4
|
-
|
|
5
|
-
* Copyright (c) 2017 Aspose Pty Ltd
|
|
6
|
-
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
|
|
5
|
+
* Copyright (c) 2017 Aspose Pty Ltd
|
|
6
|
+
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Configuration = void 0;
|
|
27
|
+
const defaultBasePath = "https://api.aspose.cloud";
|
|
28
|
+
/**
|
|
29
|
+
* Slides API configuration
|
|
30
|
+
*/
|
|
31
|
+
class Configuration {
|
|
32
|
+
constructor(appSid, appKey, baseUrl, authBaseUrl, debugMode, timeout) {
|
|
33
|
+
/**
|
|
34
|
+
* Base Url.
|
|
35
|
+
*/
|
|
36
|
+
this.baseUrl = defaultBasePath;
|
|
37
|
+
/**
|
|
38
|
+
* Base Url.
|
|
39
|
+
*/
|
|
40
|
+
this.authBaseUrl = defaultBasePath;
|
|
41
|
+
if (baseUrl) {
|
|
42
|
+
this.baseUrl = baseUrl;
|
|
43
|
+
this.authBaseUrl = baseUrl;
|
|
44
|
+
}
|
|
45
|
+
if (authBaseUrl) {
|
|
46
|
+
this.authBaseUrl = authBaseUrl;
|
|
47
|
+
}
|
|
48
|
+
this.appSid = appSid;
|
|
49
|
+
this.appKey = appKey;
|
|
50
|
+
this.debugMode = debugMode;
|
|
51
|
+
this.timeout = timeout;
|
|
52
|
+
this.customHeaders = {};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns api base url
|
|
56
|
+
*/
|
|
57
|
+
getApiBaseUrl() {
|
|
58
|
+
return this.baseUrl + "/v3.0";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.Configuration = Configuration;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Serialisation helper.
|
|
3
|
-
*/
|
|
4
|
-
export declare class ObjectSerializer {
|
|
5
|
-
/**
|
|
6
|
-
* Serilize object to json string.
|
|
7
|
-
*/
|
|
8
|
-
static serialize(data: any, type: string): any;
|
|
9
|
-
/**
|
|
10
|
-
* Deserialize object from json string
|
|
11
|
-
*/
|
|
12
|
-
static deserialize(data: any, type: string): any;
|
|
13
|
-
/**
|
|
14
|
-
* cast object to string
|
|
15
|
-
*/
|
|
16
|
-
static toString(data: any): string;
|
|
17
|
-
private static findCorrectType;
|
|
18
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Serialisation helper.
|
|
3
|
+
*/
|
|
4
|
+
export declare class ObjectSerializer {
|
|
5
|
+
/**
|
|
6
|
+
* Serilize object to json string.
|
|
7
|
+
*/
|
|
8
|
+
static serialize(data: any, type: string): any;
|
|
9
|
+
/**
|
|
10
|
+
* Deserialize object from json string
|
|
11
|
+
*/
|
|
12
|
+
static deserialize(data: any, type: string): any;
|
|
13
|
+
/**
|
|
14
|
+
* cast object to string
|
|
15
|
+
*/
|
|
16
|
+
static toString(data: any): string;
|
|
17
|
+
private static findCorrectType;
|
|
18
|
+
}
|
|
@@ -1,184 +1,185 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* MIT License
|
|
4
|
-
|
|
5
|
-
* Copyright (c) 2017 Aspose Pty Ltd
|
|
6
|
-
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
subType =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
subType =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
|
|
5
|
+
* Copyright (c) 2017 Aspose Pty Ltd
|
|
6
|
+
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ObjectSerializer = void 0;
|
|
27
|
+
//import { enumsMap, typeMap } from "../model/model";
|
|
28
|
+
const enumsMap = {};
|
|
29
|
+
const typeMap = {};
|
|
30
|
+
const primitives = [
|
|
31
|
+
"string",
|
|
32
|
+
"boolean",
|
|
33
|
+
"double",
|
|
34
|
+
"integer",
|
|
35
|
+
"long",
|
|
36
|
+
"float",
|
|
37
|
+
"number",
|
|
38
|
+
"any",
|
|
39
|
+
];
|
|
40
|
+
/**
|
|
41
|
+
* Serialisation helper.
|
|
42
|
+
*/
|
|
43
|
+
class ObjectSerializer {
|
|
44
|
+
/**
|
|
45
|
+
* Serilize object to json string.
|
|
46
|
+
*/
|
|
47
|
+
static serialize(data, type) {
|
|
48
|
+
if (data === undefined) {
|
|
49
|
+
return data;
|
|
50
|
+
}
|
|
51
|
+
else if (primitives.indexOf(type.toLowerCase()) !== -1) {
|
|
52
|
+
return data;
|
|
53
|
+
}
|
|
54
|
+
else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
|
55
|
+
let subType = type.replace("Array<", ""); // Array<Type> => Type>
|
|
56
|
+
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
|
57
|
+
const transformedData = [];
|
|
58
|
+
for (const index in data) {
|
|
59
|
+
if (data.hasOwnProperty(index)) {
|
|
60
|
+
const date = data[index];
|
|
61
|
+
transformedData.push(ObjectSerializer.serialize(date, subType));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return transformedData;
|
|
65
|
+
}
|
|
66
|
+
else if (type === "Date") {
|
|
67
|
+
return data.toString();
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
if (enumsMap[type]) {
|
|
71
|
+
return data;
|
|
72
|
+
}
|
|
73
|
+
if (!typeMap[type]) { // in case we dont know the type
|
|
74
|
+
return data;
|
|
75
|
+
}
|
|
76
|
+
// get the map for the correct type.
|
|
77
|
+
const attributeTypes = typeMap[type].getAttributeTypeMap();
|
|
78
|
+
const instance = {};
|
|
79
|
+
for (const index in attributeTypes) {
|
|
80
|
+
if (attributeTypes.hasOwnProperty(index)) {
|
|
81
|
+
const attributeType = attributeTypes[index];
|
|
82
|
+
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return instance;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Deserialize object from json string
|
|
90
|
+
*/
|
|
91
|
+
static deserialize(data, type) {
|
|
92
|
+
// polymorphism may change the actual type.
|
|
93
|
+
type = ObjectSerializer.findCorrectType(data, type);
|
|
94
|
+
if (data === undefined || data === null) {
|
|
95
|
+
return data;
|
|
96
|
+
}
|
|
97
|
+
else if (primitives.indexOf(type.toLowerCase()) !== -1) {
|
|
98
|
+
return data;
|
|
99
|
+
}
|
|
100
|
+
else if (type.lastIndexOf("Array<", 0) === 0) { // string.startsWith pre es6
|
|
101
|
+
let subType = type.replace("Array<", ""); // Array<Type> => Type>
|
|
102
|
+
subType = subType.substring(0, subType.length - 1); // Type> => Type
|
|
103
|
+
const transformedData = [];
|
|
104
|
+
for (const index in data) {
|
|
105
|
+
if (data.hasOwnProperty(index)) {
|
|
106
|
+
const date = data[index];
|
|
107
|
+
transformedData.push(ObjectSerializer.deserialize(date, subType));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return transformedData;
|
|
111
|
+
}
|
|
112
|
+
else if (type === "Date") {
|
|
113
|
+
return new Date(data);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
if (enumsMap[type]) { // is Enum
|
|
117
|
+
return data;
|
|
118
|
+
}
|
|
119
|
+
if (!typeMap[type]) { // dont know the type
|
|
120
|
+
if (type == "Buffer") {
|
|
121
|
+
return data;
|
|
122
|
+
}
|
|
123
|
+
if (typeof data == "string") {
|
|
124
|
+
return JSON.parse(data);
|
|
125
|
+
}
|
|
126
|
+
if (Buffer.isBuffer(data)) {
|
|
127
|
+
return JSON.parse(data.toString());
|
|
128
|
+
}
|
|
129
|
+
return data;
|
|
130
|
+
}
|
|
131
|
+
const instance = new typeMap[type]();
|
|
132
|
+
const attributeTypes = typeMap[type].getAttributeTypeMap();
|
|
133
|
+
for (const index in attributeTypes) {
|
|
134
|
+
if (attributeTypes.hasOwnProperty(index)) {
|
|
135
|
+
const attributeType = attributeTypes[index];
|
|
136
|
+
if (data.hasOwnProperty(attributeType.baseName)) {
|
|
137
|
+
instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return instance;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* cast object to string
|
|
146
|
+
*/
|
|
147
|
+
static toString(data) {
|
|
148
|
+
if (data === undefined)
|
|
149
|
+
return "";
|
|
150
|
+
return String(data);
|
|
151
|
+
}
|
|
152
|
+
static findCorrectType(data, expectedType) {
|
|
153
|
+
if (data === undefined) {
|
|
154
|
+
return expectedType;
|
|
155
|
+
}
|
|
156
|
+
else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) {
|
|
157
|
+
return expectedType;
|
|
158
|
+
}
|
|
159
|
+
else if (expectedType === "Date") {
|
|
160
|
+
return expectedType;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
if (enumsMap[expectedType]) {
|
|
164
|
+
return expectedType;
|
|
165
|
+
}
|
|
166
|
+
if (!typeMap[expectedType]) {
|
|
167
|
+
return expectedType; // w/e we don't know the type
|
|
168
|
+
}
|
|
169
|
+
// Check the discriminator
|
|
170
|
+
const discriminatorProperty = typeMap[expectedType].discriminator;
|
|
171
|
+
if (discriminatorProperty == null) {
|
|
172
|
+
return expectedType; // the type does not have a discriminator. use it.
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
if (data[discriminatorProperty]) {
|
|
176
|
+
return data[discriminatorProperty]; // use the type given in the discriminator
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
return expectedType; // discriminator was not present (or an empty string)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
exports.ObjectSerializer = ObjectSerializer;
|