Skip to content

Commit 1241772

Browse files
committed
Generate ReportWebhooks
1 parent 1c3d77b commit 1241772

File tree

8 files changed

+517
-210
lines changed

8 files changed

+517
-210
lines changed

src/typings/reportWebhooks/balancePlatformNotificationResponse.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,25 @@ export class BalancePlatformNotificationResponse {
1212
/**
1313
* Respond with any **2xx** HTTP status code to [accept the webhook](https://docs.adyen.com/development-resources/webhooks#accept-notifications).
1414
*/
15-
'notificationResponse'?: string;
15+
"notificationResponse"?: string;
1616

17-
static discriminator: string | undefined = undefined;
17+
static readonly discriminator: string | undefined = undefined;
1818

19-
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
19+
static readonly mapping: {[index: string]: string} | undefined = undefined;
20+
21+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
2022
{
2123
"name": "notificationResponse",
2224
"baseName": "notificationResponse",
23-
"type": "string"
25+
"type": "string",
26+
"format": ""
2427
} ];
2528

2629
static getAttributeTypeMap() {
2730
return BalancePlatformNotificationResponse.attributeTypeMap;
2831
}
32+
33+
public constructor() {
34+
}
2935
}
3036

src/typings/reportWebhooks/models.ts

Lines changed: 8 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,8 @@
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 './balancePlatformNotificationResponse';
12-
export * from './reportNotificationData';
13-
export * from './reportNotificationRequest';
14-
export * from './resource';
15-
export * from './resourceReference';
16-
17-
18-
import { BalancePlatformNotificationResponse } from './balancePlatformNotificationResponse';
19-
import { ReportNotificationData } from './reportNotificationData';
20-
import { ReportNotificationRequest } from './reportNotificationRequest';
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-
"ReportNotificationRequest.TypeEnum": ReportNotificationRequest.TypeEnum,
38-
}
39-
40-
let typeMap: {[index: string]: any} = {
41-
"BalancePlatformNotificationResponse": BalancePlatformNotificationResponse,
42-
"ReportNotificationData": ReportNotificationData,
43-
"ReportNotificationRequest": ReportNotificationRequest,
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 "./balancePlatformNotificationResponse"
2+
export * from "./reportNotificationData"
3+
export * from "./reportNotificationRequest"
4+
export * from "./resource"
5+
export * from "./resourceReference"
6+
7+
// serializing and deserializing typed objects
8+
export * from "./objectSerializer"

0 commit comments

Comments
 (0)