diff --git a/src/api.ts b/src/api.ts index c18aa2a..27e22cb 100644 --- a/src/api.ts +++ b/src/api.ts @@ -29,7 +29,13 @@ export class Takeaway { async getCountries(): Promise { const data = await this.getClient().getCountries(); - return data.config.countries.map((country: any) => new Country(this, country)); + const kitchens = data.config.kitchens.kitchens.map((kitchen: any) => { + return { + ...kitchen, + subKitchens: kitchen.subKitchens.subKitchens + }; + }); + return data.config.countries.map((country: any) => new Country(this, { ...country, kitchens: kitchens })); } async getCountryById(id: string): Promise { diff --git a/src/config.ts b/src/config.ts index bbebee4..653d702 100644 --- a/src/config.ts +++ b/src/config.ts @@ -13,7 +13,7 @@ export class TakeawayConfig { password = '4ndro1d', version = '5.7', systemVersion = '29', - appVersion = '8.29.0', + appVersion = '9999.9999.9999', appName = 'Takeaway.com' } = {}) { this.language = language; diff --git a/src/models/Country.ts b/src/models/Country.ts index 08d2d4b..ccf6b4f 100644 --- a/src/models/Country.ts +++ b/src/models/Country.ts @@ -23,6 +23,18 @@ interface Translations { vi?: string; } +interface Kitchen { + id: string; + descriptions: Translations; + imageUrl: string; + subKitchens: SubKitchen[]; +} + +interface SubKitchen { + id: string; + descriptions: Translations; +} + @Model export class Country extends BaseModel { static relationships = []; @@ -52,6 +64,7 @@ export class Country extends BaseModel { enabledRecurringPayments?: { methods?: string[]; }; + kitchens?: Kitchen[]; autoComplete?: { gp: { id?: string; diff --git a/src/models/Restaurant.ts b/src/models/Restaurant.ts index 177b407..307f281 100644 --- a/src/models/Restaurant.ts +++ b/src/models/Restaurant.ts @@ -63,6 +63,10 @@ export class Restaurant extends BaseModel { }[]; }; estimatedDeliveryTime?: string; + eta?: { + min?: number; + max?: number; + }; polygonStatus?: string; deliveryMethods?: { orderMethods?: string; @@ -97,10 +101,10 @@ export class Restaurant extends BaseModel { }[]; }; kitchens?: { - ids: string[]; + ids: number[]; }; subKitchens?: { - ids: string[]; + ids: number[]; }; popularDishes?: { ids: string[]; @@ -119,6 +123,7 @@ export class Restaurant extends BaseModel { information?: string; grade?: number; ratingCount?: number; + rating?: string; logoUrl?: string; headerImageUrl?: string; cacheKey?: string; diff --git a/src/requests/getRestaurants.ts b/src/requests/getRestaurants.ts index 45c5013..3807e0a 100644 --- a/src/requests/getRestaurants.ts +++ b/src/requests/getRestaurants.ts @@ -95,8 +95,7 @@ export default { min: '#min', max: '#max' }, - // Unknown attributes - rvd: 'rvd' + rating: 'rvd' } ], weekday: 'wd',