Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ export class Takeaway {

async getCountries(): Promise<Country[]> {
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<Country> {
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions src/models/Country.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -52,6 +64,7 @@ export class Country extends BaseModel {
enabledRecurringPayments?: {
methods?: string[];
};
kitchens?: Kitchen[];
autoComplete?: {
gp: {
id?: string;
Expand Down
9 changes: 7 additions & 2 deletions src/models/Restaurant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export class Restaurant extends BaseModel {
}[];
};
estimatedDeliveryTime?: string;
eta?: {
min?: number;
max?: number;
};
polygonStatus?: string;
deliveryMethods?: {
orderMethods?: string;
Expand Down Expand Up @@ -97,10 +101,10 @@ export class Restaurant extends BaseModel {
}[];
};
kitchens?: {
ids: string[];
ids: number[];
};
subKitchens?: {
ids: string[];
ids: number[];
};
popularDishes?: {
ids: string[];
Expand All @@ -119,6 +123,7 @@ export class Restaurant extends BaseModel {
information?: string;
grade?: number;
ratingCount?: number;
rating?: string;
logoUrl?: string;
headerImageUrl?: string;
cacheKey?: string;
Expand Down
3 changes: 1 addition & 2 deletions src/requests/getRestaurants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ export default {
min: '#min',
max: '#max'
},
// Unknown attributes
rvd: 'rvd'
rating: 'rvd'
}
],
weekday: 'wd',
Expand Down