-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBarService.ts
148 lines (129 loc) · 3.24 KB
/
BarService.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/**
* This is a generated file. Please don't change this manually.
*/
import {
Class,
odataEndpoint,
odataType,
odataTypeKey,
} from '@netatwork/odata-edm-generator';
import {
Endpoints,
} from '../../Endpoints.js';
@odataEndpoint(Endpoints.Bars)
export class Bar {
public static create<TBar extends Bar = Bar>(this: Class<TBar>, raw: Partial<TBar>): TBar {
if (raw === undefined || raw === null || raw instanceof this) { return raw as TBar; }
return new this(
raw.Id,
raw.Prop12,
raw.Prop13,
raw.Prop11,
raw.Prop14,
);
}
public constructor(
public Id: number,
public Prop12: string,
public Prop13: number,
public Prop11?: string,
public Prop14?: number,
) { }
}
export class Base {
public static create<TBase extends Base = Base>(this: Class<TBase>, raw: Partial<TBase>): TBase {
if (raw === undefined || raw === null || raw instanceof this) { return raw as TBase; }
return new this(
raw.BaseProp12,
raw.BaseProp13,
raw.BaseProp11,
raw.BaseProp14,
);
}
public constructor(
public BaseProp12: number,
public BaseProp13: string,
public BaseProp11?: string,
public BaseProp14?: number,
) { }
}
@odataEndpoint(Endpoints.Fizz)
export class Bazz {
public static create<TBazz extends Bazz = Bazz>(this: Class<TBazz>, raw: Partial<TBazz>): TBazz {
if (raw === undefined || raw === null || raw instanceof this) { return raw as TBazz; }
return new this(
raw.Id,
raw.BazzProp2,
raw.BazzProp1,
);
}
public constructor(
public Id: number,
public BazzProp2: number,
public BazzProp1?: string,
) { }
}
export class Foo {
public static create<TFoo extends Foo = Foo>(this: Class<TFoo>, raw: Partial<TFoo>): TFoo {
if (raw === undefined || raw === null || raw instanceof this) { return raw as TFoo; }
return new this(
raw.Id,
raw.ByteProp,
raw.DateStrProp,
raw.StrProp,
);
}
public constructor(
public Id: number,
public ByteProp: number,
public DateStrProp: string,
public StrProp?: string,
) { }
}
@odataEndpoint(Endpoints.Children)
// @ts-ignore needed to avoid this issue: https://github.com/microsoft/TypeScript/issues/4628
export class Child extends Base {
public static create<TChild extends Child = Child>(this: Class<TChild>, raw: Partial<TChild>): TChild {
if (raw === undefined || raw === null || raw instanceof this) { return raw as TChild; }
return new this(
raw.ChildId,
raw.BaseProp12,
raw.BaseProp13,
raw.ChildProp12,
raw.ChildProp13,
raw.BaseProp11,
raw.BaseProp14,
raw.ChildProp11,
);
}
public constructor(
public ChildId: number,
public BaseProp12: number,
public BaseProp13: string,
public ChildProp12: number,
public ChildProp13: string,
public BaseProp11?: string,
public BaseProp14?: number,
public ChildProp11?: number,
) {
super(
BaseProp12,
BaseProp13,
BaseProp11,
BaseProp14,
);
}
}
export interface Interface1 {
I1P1: string;
I1P2?: number;
}
export interface Interface2 {
I2P1: number;
I2P2?: string;
}
export enum Enum1 {
Member1 = 'Member1',
Member2 = 'Member2',
Member3 = 'Member3',
}