1
- /*
2
- * The version of the OpenAPI document: v1
3
- *
4
- *
5
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
6
- * https://openapi-generator.tech
7
- * Do not edit this class manually.
8
- */
9
-
10
-
11
- export * from './amount' ;
12
- export * from './negativeBalanceCompensationWarningNotificationData' ;
13
- export * from './negativeBalanceCompensationWarningNotificationRequest' ;
14
- export * from './resource' ;
15
- export * from './resourceReference' ;
16
-
17
-
18
- import { Amount } from './amount' ;
19
- import { NegativeBalanceCompensationWarningNotificationData } from './negativeBalanceCompensationWarningNotificationData' ;
20
- import { NegativeBalanceCompensationWarningNotificationRequest } from './negativeBalanceCompensationWarningNotificationRequest' ;
21
- import { Resource } from './resource' ;
22
- import { ResourceReference } from './resourceReference' ;
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
- "NegativeBalanceCompensationWarningNotificationRequest.TypeEnum" : NegativeBalanceCompensationWarningNotificationRequest . TypeEnum ,
38
- }
39
-
40
- let typeMap : { [ index : string ] : any } = {
41
- "Amount" : Amount ,
42
- "NegativeBalanceCompensationWarningNotificationData" : NegativeBalanceCompensationWarningNotificationData ,
43
- "NegativeBalanceCompensationWarningNotificationRequest" : NegativeBalanceCompensationWarningNotificationRequest ,
44
- "Resource" : Resource ,
45
- "ResourceReference" : ResourceReference ,
46
- }
47
-
48
- export class ObjectSerializer {
49
- public static findCorrectType ( data : any , expectedType : string ) {
50
- if ( data == undefined ) {
51
- return expectedType ;
52
- } else if ( primitives . indexOf ( expectedType . toLowerCase ( ) ) !== - 1 ) {
53
- return expectedType ;
54
- } else if ( expectedType === "Date" ) {
55
- return expectedType ;
56
- } else {
57
- if ( enumsMap [ expectedType ] ) {
58
- return expectedType ;
59
- }
60
-
61
- if ( ! typeMap [ expectedType ] ) {
62
- return expectedType ; // w/e we don't know the type
63
- }
64
-
65
- // Check the discriminator
66
- let discriminatorProperty = typeMap [ expectedType ] . discriminator ;
67
- if ( discriminatorProperty == null ) {
68
- return expectedType ; // the type does not have a discriminator. use it.
69
- } else {
70
- if ( data [ discriminatorProperty ] ) {
71
- var discriminatorType = data [ discriminatorProperty ] ;
72
- if ( typeMap [ discriminatorType ] ) {
73
- return discriminatorType ; // use the type given in the discriminator
74
- } else {
75
- return expectedType ; // discriminator did not map to a type
76
- }
77
- } else {
78
- return expectedType ; // discriminator was not present (or an empty string)
79
- }
80
- }
81
- }
82
- }
83
-
84
- public static serialize ( data : any , type : string ) {
85
- if ( data == undefined ) {
86
- return data ;
87
- } else if ( primitives . indexOf ( type . toLowerCase ( ) ) !== - 1 ) {
88
- return data ;
89
- } else if ( type . lastIndexOf ( "Array<" , 0 ) === 0 ) { // string.startsWith pre es6
90
- let subType : string = type . replace ( "Array<" , "" ) ; // Array<Type> => Type>
91
- subType = subType . substring ( 0 , subType . length - 1 ) ; // Type> => Type
92
- let transformedData : any [ ] = [ ] ;
93
- for ( let index = 0 ; index < data . length ; index ++ ) {
94
- let datum = data [ index ] ;
95
- transformedData . push ( ObjectSerializer . serialize ( datum , subType ) ) ;
96
- }
97
- return transformedData ;
98
- } else if ( type === "Date" ) {
99
- return data . toISOString ( ) ;
100
- } else if ( type === "SaleToAcquirerData" ) {
101
- const dataString = JSON . stringify ( data ) ;
102
- return Buffer . from ( dataString ) . toString ( "base64" ) ;
103
- } else {
104
- if ( enumsMap [ type ] ) {
105
- return data ;
106
- }
107
- if ( ! typeMap [ type ] ) { // in case we dont know the type
108
- return data ;
109
- }
110
-
111
- // Get the actual type of this object
112
- type = this . findCorrectType ( data , type ) ;
113
-
114
- // get the map for the correct type.
115
- let attributeTypes = typeMap [ type ] . getAttributeTypeMap ( ) ;
116
- let instance : { [ index : string ] : any } = { } ;
117
- for ( let index = 0 ; index < attributeTypes . length ; index ++ ) {
118
- let attributeType = attributeTypes [ index ] ;
119
- instance [ attributeType . baseName ] = ObjectSerializer . serialize ( data [ attributeType . name ] , attributeType . type ) ;
120
- }
121
- return instance ;
122
- }
123
- }
124
-
125
- public static deserialize ( data : any , type : string ) {
126
- // polymorphism may change the actual type.
127
- type = ObjectSerializer . findCorrectType ( data , type ) ;
128
- if ( data == undefined ) {
129
- return data ;
130
- } else if ( primitives . indexOf ( type . toLowerCase ( ) ) !== - 1 ) {
131
- return data ;
132
- } else if ( type . lastIndexOf ( "Array<" , 0 ) === 0 ) { // string.startsWith pre es6
133
- let subType : string = type . replace ( "Array<" , "" ) ; // Array<Type> => Type>
134
- subType = subType . substring ( 0 , subType . length - 1 ) ; // Type> => Type
135
- let transformedData : any [ ] = [ ] ;
136
- for ( let index = 0 ; index < data . length ; index ++ ) {
137
- let datum = data [ index ] ;
138
- transformedData . push ( ObjectSerializer . deserialize ( datum , subType ) ) ;
139
- }
140
- return transformedData ;
141
- } else if ( type === "Date" ) {
142
- return new Date ( data ) ;
143
- } else {
144
- if ( enumsMap [ type ] ) { // is Enum
145
- return data ;
146
- }
147
-
148
- if ( ! typeMap [ type ] ) { // dont know the type
149
- return data ;
150
- }
151
- let instance = new typeMap [ type ] ( ) ;
152
- let attributeTypes = typeMap [ type ] . getAttributeTypeMap ( ) ;
153
- for ( let index = 0 ; index < attributeTypes . length ; index ++ ) {
154
- let attributeType = attributeTypes [ index ] ;
155
- instance [ attributeType . name ] = ObjectSerializer . deserialize ( data [ attributeType . baseName ] , attributeType . type ) ;
156
- }
157
- return instance ;
158
- }
159
- }
160
- }
1
+ export * from "./amount"
2
+ export * from "./negativeBalanceCompensationWarningNotificationData"
3
+ export * from "./negativeBalanceCompensationWarningNotificationRequest"
4
+ export * from "./resource"
5
+ export * from "./resourceReference"
6
+
7
+ // serializing and deserializing typed objects
8
+ export * from "./objectSerializer"
0 commit comments