Skip to content

Commit c3432fb

Browse files
taeyzzzThanetpon Kultontikorn
andauthored
Feat generate (#19)
* WIP: generate codegen * WIP: create script to generate codegen and use it * WIP * add TODO * change to use string template for plugin * able to generate codegen config with output file * generate done, WIP: with header * done, deploy and test * fix issue about custom type for input * able to generate custom input type * generate correctly, WIP: verify * update * remove * verify --------- Co-authored-by: Thanetpon Kultontikorn <[email protected]>
1 parent 5b70539 commit c3432fb

36 files changed

+864
-3559
lines changed

Agoda.Graphql/BookingQueries/PropertyBooking/GetBookingListByBookingIds.generated.cs

Lines changed: 74 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,10 @@
44
using Newtonsoft.Json.Converters;
55
using Agoda.Graphql;
66

7-
8-
9-
10-
#region GetBookingListByBookingIds
11-
12-
namespace Agoda.Graphql.BookingQueries.PropertyBooking.GetBookingListByBookingIds
7+
namespace Agoda.Graphql.BookingQueries.PropertyBooking
138
{
14-
15-
/// <summary>Operation Type</summary>
16-
public partial class Query : QueryBase<Data>
17-
{
9+
public class Query : QueryBase<Data>
10+
{
1811
private const string _query = @"query GetBookingListByBookingIds($bookingIds: [Int!]!) {
1912
BookingDetailsByBookingIds(bookingIds: $bookingIds) {
2013
baseBooking {
@@ -70,249 +63,159 @@ public partial class Query : QueryBase<Data>
7063
}
7164
}";
7265

66+
public List<int> BookingIds { get; }
67+
7368
public Query(List<int> bookingIds, IResultProcessor<Data> resultProcessor = null) : base(resultProcessor)
7469
{
7570
BookingIds = bookingIds;
7671
}
7772

78-
public List<int> BookingIds { get; }
7973
protected override string QueryText => _query;
8074

8175
protected override Dictionary<string, object> Variables => new Dictionary<string, object>
8276
{
83-
{ "bookingIds", BookingIds },
84-
};
77+
{ "bookingIds", BookingIds }
78+
};
8579
}
8680

8781
public sealed class Data
88-
{
89-
90-
82+
{
9183
[JsonProperty("BookingDetailsByBookingIds")]
92-
public List<BookingDetailsByBookingIds> BookingDetailsByBookingIds { get; set; }
84+
public List<CrossProductBookingMeta> BookingDetailsByBookingIds { get; set; }
9385
}
94-
9586

96-
/// <summary>Inner Model</summary>
97-
public sealed class BookingDetailsByBookingIds
87+
public sealed class BaseBookingInfo
9888
{
99-
100-
101-
[JsonProperty("baseBooking")]
102-
public BaseBooking BaseBooking { get; set; }
103-
104-
105-
[JsonProperty("propertyBooking")]
106-
public PropertyBooking PropertyBooking { get; set; }
107-
}
108-
109-
/// <summary>Inner Model</summary>
110-
public sealed class BaseBooking
111-
{
112-
113-
11489
[JsonProperty("bookingId")]
11590
public long BookingId { get; set; }
11691
}
11792

118-
/// <summary>Inner Model</summary>
119-
public sealed class PropertyBooking
120-
{
121-
122-
123-
[JsonProperty("checkinDate")]
124-
public LocalDateTime? CheckinDate { get; set; }
125-
126-
127-
[JsonProperty("checkoutDate")]
128-
public LocalDateTime? CheckoutDate { get; set; }
129-
130-
131-
[JsonProperty("bookingHotelRooms")]
132-
public List<BookingHotelRooms> BookingHotelRooms { get; set; }
133-
134-
135-
[JsonProperty("paymentModel")]
136-
public int? PaymentModel { get; set; }
137-
138-
139-
[JsonProperty("guests")]
140-
public List<Guests> Guests { get; set; }
141-
142-
143-
[JsonProperty("property")]
144-
public Property Property { get; set; }
145-
146-
147-
[JsonProperty("dmc")]
148-
public Dmc Dmc { get; set; }
149-
150-
151-
[JsonProperty("resellBookingFeature")]
152-
public ResellBookingFeature ResellBookingFeature { get; set; }
153-
154-
155-
[JsonProperty("acknowledge")]
156-
public Acknowledge Acknowledge { get; set; }
157-
158-
159-
[JsonProperty("occupancy")]
160-
public Occupancy Occupancy { get; set; }
161-
162-
163-
[JsonProperty("resellBooking")]
164-
public ResellBooking ResellBooking { get; set; }
165-
}
166-
167-
/// <summary>Inner Model</summary>
168-
public sealed class BookingHotelRooms
93+
public sealed class PropertyRoom
16994
{
170-
171-
17295
[JsonProperty("roomTypeId")]
17396
public int? RoomTypeId { get; set; }
17497
}
17598

176-
/// <summary>Inner Model</summary>
177-
public sealed class Guests
99+
public sealed class PropertyGuest
178100
{
179-
180-
181101
[JsonProperty("firstName")]
182102
public string FirstName { get; set; }
183-
184-
185103
[JsonProperty("lastName")]
186104
public string LastName { get; set; }
187-
188-
189105
[JsonProperty("guestNo")]
190106
public int GuestNo { get; set; }
191107
}
192108

193-
/// <summary>Inner Model</summary>
194-
public sealed class Property
109+
public sealed class PropertyInfo
195110
{
196-
197-
198111
[JsonProperty("hotelId")]
199112
public int HotelId { get; set; }
200113
}
201114

202-
/// <summary>Inner Model</summary>
203-
public sealed class Dmc
115+
public sealed class PropertyDmc
204116
{
205-
206-
207117
[JsonProperty("dmcId")]
208118
public int? DmcId { get; set; }
209119
}
210120

211-
/// <summary>Inner Model</summary>
212-
public sealed class ResellBookingFeature
121+
public sealed class SmartFlexBookingQueryInput
213122
{
214-
215-
216-
[JsonProperty("smartFlex")]
217-
public SmartFlex SmartFlex { get; set; }
123+
[JsonProperty("smartFlexScenario")]
124+
public int? SmartFlexScenario { get; set; }
218125
}
219126

220-
/// <summary>Inner Model</summary>
221-
public sealed class SmartFlex
127+
public sealed class ReplacementBooking
222128
{
223-
224-
225-
[JsonProperty("smartFlexBooking")]
226-
public SmartFlexBooking SmartFlexBooking { get; set; }
227-
228-
229-
[JsonProperty("replacementBooking")]
230-
public ReplacementBooking ReplacementBooking { get; set; }
129+
[JsonProperty("smartFlexScenario")]
130+
public int? SmartFlexScenario { get; set; }
231131
}
232132

233-
/// <summary>Inner Model</summary>
234-
public sealed class SmartFlexBooking
133+
public sealed class SmartFlexQueryInput
235134
{
236-
237-
238-
[JsonProperty("smartFlexScenario")]
239-
public int? SmartFlexScenario { get; set; }
135+
[JsonProperty("smartFlexBooking")]
136+
public SmartFlexBookingQueryInput SmartFlexBooking { get; set; }
137+
[JsonProperty("replacementBooking")]
138+
public ReplacementBooking ReplacementBooking { get; set; }
240139
}
241140

242-
/// <summary>Inner Model</summary>
243-
public sealed class ReplacementBooking
141+
public sealed class ResellBookingFeatureQueryInput
244142
{
245-
246-
247-
[JsonProperty("smartFlexScenario")]
248-
public int? SmartFlexScenario { get; set; }
143+
[JsonProperty("smartFlex")]
144+
public SmartFlexQueryInput SmartFlex { get; set; }
249145
}
250146

251-
/// <summary>Inner Model</summary>
252-
public sealed class Acknowledge
147+
public sealed class PropertyBookingAcknowledge
253148
{
254-
255-
256149
[JsonProperty("ackTypeId")]
257150
public int AckTypeId { get; set; }
258151
}
259152

260-
/// <summary>Inner Model</summary>
261-
public sealed class Occupancy
153+
public sealed class OccupancyInfo
262154
{
263-
264-
265155
[JsonProperty("numberOfAdults")]
266156
public int NumberOfAdults { get; set; }
267-
268-
269157
[JsonProperty("numberOfChildren")]
270158
public int NumberOfChildren { get; set; }
271159
}
272160

273-
/// <summary>Inner Model</summary>
274-
public sealed class ResellBooking
161+
public sealed class BookingGuest
162+
{
163+
[JsonProperty("firstName")]
164+
public string FirstName { get; set; }
165+
[JsonProperty("lastName")]
166+
public string LastName { get; set; }
167+
}
168+
169+
public sealed class EnigmaGuestInfo
170+
{
171+
[JsonProperty("guests")]
172+
public List<BookingGuest> Guests { get; set; }
173+
}
174+
175+
public sealed class ResellBookingDetails
275176
{
276-
277-
278177
[JsonProperty("resellBookingId")]
279178
public int? ResellBookingId { get; set; }
280-
281-
282179
[JsonProperty("resellStatusId")]
283180
public int ResellStatusId { get; set; }
284-
285-
286181
[JsonProperty("resellTypeId")]
287182
public int? ResellTypeId { get; set; }
288-
289-
290183
[JsonProperty("guestInfo")]
291-
public GuestInfo GuestInfo { get; set; }
184+
public EnigmaGuestInfo GuestInfo { get; set; }
292185
}
293186

294-
/// <summary>Inner Model</summary>
295-
public sealed class GuestInfo
187+
public sealed class PropertyBooking
296188
{
297-
298-
189+
[JsonProperty("checkinDate")]
190+
public DateTime? CheckinDate { get; set; }
191+
[JsonProperty("checkoutDate")]
192+
public DateTime? CheckoutDate { get; set; }
193+
[JsonProperty("bookingHotelRooms")]
194+
public List<PropertyRoom> BookingHotelRooms { get; set; }
195+
[JsonProperty("paymentModel")]
196+
public int? PaymentModel { get; set; }
299197
[JsonProperty("guests")]
300-
public List<_Guests> Guests { get; set; }
198+
public List<PropertyGuest> Guests { get; set; }
199+
[JsonProperty("property")]
200+
public PropertyInfo Property { get; set; }
201+
[JsonProperty("dmc")]
202+
public PropertyDmc Dmc { get; set; }
203+
[JsonProperty("resellBookingFeature")]
204+
public ResellBookingFeatureQueryInput ResellBookingFeature { get; set; }
205+
[JsonProperty("acknowledge")]
206+
public PropertyBookingAcknowledge Acknowledge { get; set; }
207+
[JsonProperty("occupancy")]
208+
public OccupancyInfo Occupancy { get; set; }
209+
[JsonProperty("resellBooking")]
210+
public ResellBookingDetails ResellBooking { get; set; }
301211
}
302212

303-
/// <summary>Inner Model</summary>
304-
public sealed class _Guests
213+
public sealed class CrossProductBookingMeta
305214
{
306-
307-
308-
[JsonProperty("firstName")]
309-
public string FirstName { get; set; }
310-
311-
312-
[JsonProperty("lastName")]
313-
public string LastName { get; set; }
215+
[JsonProperty("baseBooking")]
216+
public BaseBookingInfo BaseBooking { get; set; }
217+
[JsonProperty("propertyBooking")]
218+
public PropertyBooking PropertyBooking { get; set; }
314219
}
315-
}
316-
317-
#endregion
318220

221+
}

0 commit comments

Comments
 (0)