Documentation ¶
Overview ¶
Package zomato provides a client for using Zomato API.
You can read the API server documentation at https://developers.zomato.com/api
Usage ¶
Construct a new Zomato client, then use the various methods on the client to access different parts of the Zomato API.
For demonstration:
package main import ( "context" "github.com/go-india/zomato" ) var ctx = context.Background() func main() { client := zomato.NewClient(API_KEY) // Gets restaurant details. res, err := client.Restaurant(ctx, 463) // Search for restaurants. restaurants, err := c.Search(ctx, zomato.SearchReq{ Query: "delhi", Radius: 200, }) // Gets reviews of the restaurant. reviews, err := c.Reviews(ctx, zomato.ReviewsReq{ RestaurantID: 463, Count: 100, }) }
Notes:
* Using the https://godoc.org/context package for passing context.
* Look at tests(*_test.go) files for more sample usage.
Authentication ¶
If you are using concrete Client, then you need to assign client.Auth field to make the client methods use authenticator for requests.
client := zomato.Client{ Auth: zomato.NewAuth(API_KEY), }
This will add API Key to each request made by client methods.
Index ¶
- Constants
- Variables
- func NewAuth(APIKey string) func(Requester) Requester
- type Categorie
- type CategoriesReq
- type CategoriesResp
- type CitiesReq
- type CitiesResp
- type City
- type Client
- func (c Client) Categories(ctx context.Context) (resp CategoriesResp, err error)
- func (c Client) Cities(ctx context.Context, req CitiesReq) (resp CitiesResp, err error)
- func (c Client) Collections(ctx context.Context, req CollectionsReq) (resp CollectionsResp, err error)
- func (c Client) Cuisines(ctx context.Context, req CuisinesReq) (resp CuisinesResp, err error)
- func (c Client) DailyMenu(ctx context.Context, restaurantID int64) (resp DailyMenuResp, err error)
- func (c Client) Do(r Requester, intoPtr interface{}) error
- func (c Client) Establishments(ctx context.Context, req EstablishmentsReq) (resp EstablishmentsResp, err error)
- func (c Client) GeoCode(ctx context.Context, lat, long float64) (resp GeoCodeResp, err error)
- func (c Client) LocationDetails(ctx context.Context, entityID int64, entityType EntityType) (resp LocationDetailsResp, err error)
- func (c Client) Locations(ctx context.Context, req LocationsReq) (resp LocationsResp, err error)
- func (c Client) Restaurant(ctx context.Context, restaurantID int64) (resp Restaurant, err error)
- func (c Client) Reviews(ctx context.Context, req ReviewsReq) (resp ReviewsResp, err error)
- func (c Client) Search(ctx context.Context, req SearchReq) (resp SearchResp, err error)
- type Collection
- type CollectionsReq
- type CollectionsResp
- type Cuisine
- type CuisinesReq
- type CuisinesResp
- type DailyMenu
- type DailyMenuReq
- type DailyMenuResp
- type Dish
- type EntityType
- type ErrAPI
- type Establishment
- type EstablishmentsReq
- type EstablishmentsResp
- type Event
- type GeoCodeReq
- type GeoCodeResp
- type Location
- type LocationDetailsReq
- type LocationDetailsResp
- type LocationsReq
- type LocationsResp
- type Order
- type Photo
- type Popularity
- type Requester
- type RequesterFunc
- type Restaurant
- type RestaurantLocation
- type RestaurantReq
- type Review
- type ReviewsReq
- type ReviewsResp
- type SearchReq
- type SearchResp
- type Sort
- type User
- type UserRating
Constants ¶
const ( // DefaultBaseURL is the default base server URL of the API. DefaultBaseURL = "https://developers.zomato.com/api" // DefaultUserAgent is the default user agent used by client. DefaultUserAgent = "go-india/zomato" )
Variables ¶
var ( // ErrNoAuth is returned when auth is not defined for a client. ErrNoAuth = errors.New("zomato: no authenticator in client") )
Functions ¶
Types ¶
type Categorie ¶
type Categorie struct { ID int64 `json:"id"` // ID of the category type Name string `json:"name"` // Name of the category type }
Categorie has categorie details.
type CategoriesResp ¶
type CategoriesResp struct { Categories []struct { Categorie *Categorie `json:"categories,omitempty"` } `json:"categories,omitempty"` }
CategoriesResp holds categories response
type CitiesReq ¶
type CitiesReq struct { Query string `url:"q,omitempty"` // query by city name Latitude float64 `url:"lat,omitempty"` // latitude Longitude float64 `url:"lon,omitempty"` // longitude CityIDs []int64 `url:"city_ids,omitempty"` // comma separated city_id values Count uint64 `url:"count,omitempty"` // number of max results to display }
CitiesReq parameters
type CitiesResp ¶
type CitiesResp struct { LocationSuggestions []City `json:"location_suggestions,omitempty"` Status *string `json:"status,omitempty"` HasMore *bool // `json:"has_more,omitempty"` HasTotal *bool // `json:"has_total,omitempty"` }
CitiesResp has cities returned by CitiesReq query
func (*CitiesResp) UnmarshalJSON ¶
func (c *CitiesResp) UnmarshalJSON(data []byte) error
UnmarshalJSON convert JSON data to struct
type City ¶
type City struct { ID int64 `json:"id"` // ID of the city Name string `json:"name"` // City name CountryID *int64 `json:"country_id,omitempty"` // ID of the country CountryName *string `json:"country_name,omitempty"` // Name of the country CountryFlagURL *string `json:"country_flag_url,omitempty"` // Country Flag picture URL ShouldExperimentWith *bool // `json:"should_experiment_with,omitempty"` DiscoveryEnabled *bool // `json:"discovery_enabled,omitempty"` HasNewAdFormat *bool // `json:"has_new_ad_format,omitempty"` IsState *bool // `json:"is_state,omitempty"` // Whether this location is a state StateID *int64 `json:"state_id,omitempty"` // ID of the state StateName *string `json:"state_name,omitempty"` // Name of the state StateCode *string `json:"state_code,omitempty"` // Short code for the state }
City holds city details
func (*City) UnmarshalJSON ¶
UnmarshalJSON convert JSON data to struct
type Client ¶
type Client struct { // BaseURL is the base URL of the API server. BaseURL *url.URL // User agent used when communicating with the API. UserAgent string // HTTPClient is a reusable http client instance. HTTPClient *http.Client // Auth holds authenticator function used to authenticate requests. // // Client methods uses Auth to add APIKey to requests. // Use NewAuth(apikey) to generate a new authenticator. Auth func(Requester) Requester }
Client is an zomato HTTP REST API client instance.
Its zero value is usable client that uses http.DefaultTransport. Client is safe for use by multiple go routines.
func NewClient ¶
NewClient returns a new zomato authenticated API client.
Use returned client's methods to access various API functions.
func (Client) Categories ¶
func (c Client) Categories(ctx context.Context) (resp CategoriesResp, err error)
Categories gets a list of categories.
List of all restaurants categorized under a particular restaurant type can be obtained using /Search API with Category ID as inputs
func (Client) Cities ¶
Cities gets city details.
Find the Zomato ID and other details for a city. You can obtain the Zomato City ID in one of the following ways:
City Name in the Search Query - Returns list of cities matching the query Using coordinates - Identifies the city details based on the coordinates of any location inside a city
If you already know the Zomato City ID, this API can be used to get other details of the city.
func (Client) Collections ¶
func (c Client) Collections(ctx context.Context, req CollectionsReq) (resp CollectionsResp, err error)
Collections returns Zomato Restaurant Collections in a City.
The location/City input can be provided in the following ways:
Using Zomato City ID Using coordinates of any location within a city
List of all restaurants listed in any particular Zomato Collection can be obtained using the '/search' API with Collection ID and Zomato City ID as the input
func (Client) Cuisines ¶
func (c Client) Cuisines(ctx context.Context, req CuisinesReq) (resp CuisinesResp, err error)
Cuisines gets a list of all cuisines of restaurants listed in a city.
The location/City input can be provided in the following ways:
Using Zomato City ID Using coordinates of any location within a city
List of all restaurants serving a particular cuisine can be obtained using '/search' API with cuisine ID and location details
func (Client) Establishments ¶
func (c Client) Establishments(ctx context.Context, req EstablishmentsReq) (resp EstablishmentsResp, err error)
Establishments gets a list of restaurant types in a city.
The location/City input can be provided in the following ways:
Using Zomato City ID Using coordinates of any location within a city
List of all restaurants categorized under a particular restaurant type can be obtained using /Search API with Establishment ID and location details as inputs.
func (Client) GeoCode ¶
GeoCode gets location details based on coordinates.
Get Foodie and Nightlife Index, list of popular cuisines and nearby restaurants around the given coordinates
func (Client) LocationDetails ¶
func (c Client) LocationDetails(ctx context.Context, entityID int64, entityType EntityType) (resp LocationDetailsResp, err error)
LocationDetails gets Zomato location details.
Get Foodie Index, Nightlife Index, Top Cuisines and Best rated restaurants in a given location.
func (Client) Locations ¶
func (c Client) Locations(ctx context.Context, req LocationsReq) (resp LocationsResp, err error)
Locations searches for locations.
Search for Zomato locations by keyword. Provide coordinates to get better search results.
func (Client) Restaurant ¶
Restaurant gets restaurant details.
Get detailed restaurant information using Zomato restaurant ID. Partner Access is required to access photos and reviews.
func (Client) Reviews ¶
func (c Client) Reviews(ctx context.Context, req ReviewsReq) (resp ReviewsResp, err error)
Reviews gets restaurant reviews.
Get restaurant reviews using the Zomato restaurant ID. Only 5 latest reviews are available under the Basic API plan.
func (Client) Search ¶
Search provides search for restaurants.
The location input can be specified using Zomato location ID or coordinates. Cuisine/Establishment/Collection IDs can be obtained from respective API calls.
Get up to 100 restaurants by changing the 'start' and 'count' parameters with the maximum value of count being 20.
Examples:
To search for 'Italian' restaurants in 'Manhattan, New York City', set cuisines = 55, entity_id = 94741 and entity_type = zone To search for 'cafes' in 'Manhattan, New York City', set establishment_type = 1, entity_type = zone and entity_id = 94741 Get list of all restaurants in 'Trending this Week' collection in 'New York City' by using entity_id = 280, entity_type = city and collection_id = 1
Partner Access is required to access photos and reviews.
type Collection ¶
type Collection struct { ID *int64 `json:"collection_id,omitempty"` // ID of the collection of restaurants URL *string `json:"url,omitempty"` // Collection name Title *string `json:"title,omitempty"` // URL of the collection page Description *string `json:"description,omitempty"` // Short description of the collection RestaurantsCount *int64 `json:"res_count,omitempty"` // URL for header image of the collection ImageURL *string `json:"image_url,omitempty"` // Number of restaurants in the collection }
Collection holds collection details
type CollectionsReq ¶
type CollectionsReq struct { CityID int64 `url:"city_id,omitempty"` // id of the city for which collections are needed Latitude float64 `url:"lat,omitempty"` // latitude of any point within a city Longitude float64 `url:"lon,omitempty"` // longitude of any point within a city Count uint64 `url:"count,omitempty"` // max number of results needed }
CollectionsReq parameters
type CollectionsResp ¶
type CollectionsResp struct { Collections []struct { Collection *Collection `json:"collection,omitempty"` } `json:"collections,omitempty"` DisplayText *string `json:"display_text,omitempty"` HasMore *bool `json:"has_more,omitempty"` HasTotal *bool `json:"has_total,omitempty"` }
CollectionsResp holds collections returned from CollectionsReq query
func (*CollectionsResp) UnmarshalJSON ¶
func (c *CollectionsResp) UnmarshalJSON(data []byte) error
UnmarshalJSON convert JSON data to struct
type Cuisine ¶
type Cuisine struct { ID int64 `json:"cuisine_id"` // ID of the cuisine Name string `json:"cuisine_name"` // Name of the cuisine }
Cuisine holds cuisine details
type CuisinesReq ¶
type CuisinesReq struct { CityID int64 `url:"city_id,omitempty"` // id of the city for which cuisines are needed Latitude float64 `url:"lat,omitempty"` // latitude of any point within a city Longitude float64 `url:"lon,omitempty"` // longitude of any point within a city }
CuisinesReq parameters
type CuisinesResp ¶
type CuisinesResp struct { Cuisines []struct { Cuisine *Cuisine `json:"cuisine,omitempty"` } `json:"cuisines,omitempty"` }
CuisinesResp holds cuisines from CuisinesReq query
type DailyMenu ¶
type DailyMenu struct { ID *int64 `json:"daily_menu_id,string,omitempty"` // ID of the restaurant Name *string `json:"name,omitempty"` // Name of the restaurant StartDate *time.Time // `json:"start_date,omitempty"` // Daily Menu start timestamp EndDate *time.Time // `json:"end_date,omitempty"` // Daily Menu end timestamp Dishes []struct { Dish *Dish `json:"dish,omitempty"` } `json:"dishes,omitempty"` // Menu item in the category }
DailyMenu holds daily menu
func (*DailyMenu) UnmarshalJSON ¶
UnmarshalJSON convert JSON data to struct
type DailyMenuReq ¶
type DailyMenuReq struct { // ID of restaurant whose details are requested RestaurantID int64 `url:"res_id" validate:"required"` }
DailyMenuReq parameters
type DailyMenuResp ¶
type DailyMenuResp struct { Status *string `json:"status,omitempty"` DailyMenus []struct { DailyMenu *DailyMenu `json:"daily_menu,omitempty"` } `json:"daily_menus,omitempty"` // List of restaurant's menu details }
DailyMenuResp holds daily menus of a restaurant
type Dish ¶
type Dish struct { ID *int64 `json:"dish_id,string,omitempty"` // Menu Item ID Name *string `json:"name,omitempty"` // Menu Item Title Price *string `json:"price,omitempty"` // Menu Item Price }
Dish holds dish/menu item details
type EntityType ¶
type EntityType string
EntityType defines entity types used for location type
const ( CityEntity EntityType = "city" SubZone EntityType = "subzone" Zone EntityType = "zone" Landmark EntityType = "landmark" Metro EntityType = "metro" Group EntityType = "group" )
Entity Types
type Establishment ¶
type Establishment struct { ID int64 `json:"id"` // ID of the establishment type Name string `json:"name"` // Name of the establishment type }
Establishment holds establishment details
type EstablishmentsReq ¶
type EstablishmentsReq struct { CityID int64 `url:"city_id,omitempty"` // id of the city Latitude float64 `url:"lat,omitempty"` // latitude of any point within a city Longitude float64 `url:"lon,omitempty"` // longitude of any point within a city }
EstablishmentsReq parameters
type EstablishmentsResp ¶
type EstablishmentsResp struct { Establishments []struct { Establishment *Establishment `json:"establishment,omitempty"` } `json:"establishments,omitempty"` }
EstablishmentsResp holds establishments from CuisinesReq query
type Event ¶
type Event struct { ID *int64 `json:"event_id,omitempty"` StartDate *time.Time // `json:"start_date"` EndDate *time.Time // `json:"end_date"` EndTime *time.Time // `json:"end_time"` StartTime *time.Time // `json:"start_time"` DateAdded *time.Time // `json:"date_added"` IsActive *bool // `json:"is_active"` IsValid *bool // `json:"is_valid"` IsEndTimeSet *bool // `json:"is_end_time_set"` Photos []struct { Photo *Photo `json:"photo,omitempty"` } `json:"photos,omitempty"` Restaurants []Restaurant `json:"restaurants,omitempty"` Title *string `json:"title,omitempty"` Description *string `json:"description,omitempty"` DisplayTime *string `json:"display_time,omitempty"` DisplayDate *string `json:"display_date,omitempty"` Disclaimer *string `json:"disclaimer,omitempty"` EventCategory *int64 `json:"event_category,omitempty"` EventCategoryName *string `json:"event_category_name,omitempty"` BookLinkURL *string `json:"book_link,omitempty"` FriendlyStartDate *string `json:"friendly_start_date,omitempty"` FriendlyEndDate *string `json:"friendly_end_date,omitempty"` FriendlyTiming *string `json:"friendly_timing_str,omitempty"` }
Event holds zomato event details
func (*Event) UnmarshalJSON ¶
UnmarshalJSON convert JSON data to struct
type GeoCodeReq ¶
type GeoCodeReq struct { Latitude float64 `url:"lat" validate:"required"` // latitude of any point within a city Longitude float64 `url:"lon" validate:"required"` // longitude of any point within a city }
GeoCodeReq parameters
type GeoCodeResp ¶
type GeoCodeResp struct { Location *Location `json:"location,omitempty"` Popularity *Popularity `json:"popularity,omitempty"` LinkURL *string `json:"link,omitempty"` NearbyRestaurants []struct { Restaurant *Restaurant `json:"restaurant,omitempty"` } `json:"nearby_restaurants,omitempty"` }
GeoCodeResp holds foodie and Nightlife Index, list of popular cuisines and nearby restaurants around the given coordinates
type Location ¶
type Location struct { // Type of location: one of [city, zone, subzone, landmark, group, metro, street] EntityType *string `json:"entity_type,omitempty"` // ID of location: (entity_id, entity_type) tuple uniquely identifies a location EntityID *int64 `json:"entity_id,omitempty"` // Name of the location Title *string `json:"title,omitempty"` // Coordinates of the (centre of) location Latitude *float64 // `json:"latitude,string,omitempty"` // Coordinates of the (centre of) location Longitude *float64 // `json:"longitude,string,omitempty"` // ID of city CityID *int64 `json:"city_id,omitempty"` // Name of the city CityName *string `json:"city_name,omitempty"` // ID of country CountryID *int64 `json:"country_id,omitempty"` // Name of the country CountryName *string `json:"country_name,omitempty"` }
Location holds details of location
func (*Location) UnmarshalJSON ¶
UnmarshalJSON convert JSON data to struct
type LocationDetailsReq ¶
type LocationDetailsReq struct { EntityID int64 `url:"entity_id" validate:"required"` // location id obtained from locations api EntityType EntityType `url:"entity_type" validate:"required"` // location type obtained from locations api }
LocationDetailsReq parameters
type LocationDetailsResp ¶
type LocationDetailsResp struct { Location *Location `json:"location,omitempty"` NumberOfRestaurant int64 `json:"num_restaurant,omitempty"` BestRatedRestaurant []struct { Restaurant *Restaurant `json:"restaurant,omitempty"` } `json:"best_rated_restaurant,omitempty"` Experts []struct { User *User `json:"user,omitempty"` } `json:"experts,omitempty"` }
LocationDetailsResp holds location details
type LocationsReq ¶
type LocationsReq struct { Query string `url:"query" validate:"required"` // suggestion for location name Latitude float64 `url:"lat,omitempty"` // latitude Longitude float64 `url:"lon,omitempty"` // longitude Count uint64 `url:"count,omitempty"` // number of max results to display }
LocationsReq parameters
type LocationsResp ¶
type LocationsResp struct { LocationSuggestions []Location `json:"location_suggestions,omitempty"` Status *string `json:"status,omitempty"` HasMore *bool // json:"has_more,omitempty"` HasTotal *bool // `json:"has_total,omitempty"` }
LocationsResp holds locations from LocationsReq query
func (*LocationsResp) UnmarshalJSON ¶
func (l *LocationsResp) UnmarshalJSON(data []byte) error
UnmarshalJSON convert JSON data to struct
type Photo ¶
type Photo struct { URL *string `json:"url,omitempty"` // URL of the image file ThumbnailURL *string `json:"thumb_url,omitempty"` // URL for 200 X 200 thumb image file Order *int64 `json:"order,omitempty"` MD5Sum *string `json:"md5sum,omitempty"` PhotoID *int64 `json:"photo_id,omitempty"` UUID *int64 `json:"uuid,omitempty"` Type *string `json:"type,omitempty"` ID *string `json:"id,omitempty"` // ID of the photo User *User `json:"user,omitempty"` // User who uploaded the photo RestaurantID *int64 `json:"res_id,string,omitempty"` // ID of restaurant for which the image was uploaded Caption *string `json:"caption,omitempty"` // Caption of the photo // Unix timestamp when the photo was uploaded Timestamp *time.Time // `json:"timestamp,string"` // User friendly time string; denotes when the photo was uploaded FriendlyTime *string `json:"friendly_time,omitempty"` Width *int64 `json:"width,string,omitempty"` // Image width in pixel; usually 640 Height *int64 `json:"height,string,omitempty"` // Image height in pixel; usually 640 CommentsCount *int64 `json:"comments_count,string,omitempty"` // Number of comments on photo LikesCount *int64 `json:"likes_count,string,omitempty"` // Number of likes on photo }
Photo holds photo details
func (*Photo) UnmarshalJSON ¶
UnmarshalJSON convert JSON data to struct
type Popularity ¶
type Popularity struct { Popularity *float64 `json:"popularity,string,omitempty"` // Foodie index of a location out of 5.00 NightlifeIndex *float64 `json:"nightlife_index,string,omitempty"` // Nightlife index of a location out of 5.00 NearbyRestaurantIDs []int64 // `json:"nearby_res,omitempty"` TopCuisines []string `json:"top_cuisines,omitempty"` // Most popular cuisines in the locality PopularityRestaurant *int64 `json:"popularity_res,string,omitempty"` NightlifeRestaurant *int64 `json:"nightlife_res,string,omitempty"` Subzone *string `json:"subzone,omitempty"` SubzoneID *int64 `json:"subzone_id,omitempty"` City *string `json:"city,omitempty"` }
Popularity has popularity details
func (*Popularity) UnmarshalJSON ¶
func (p *Popularity) UnmarshalJSON(data []byte) error
UnmarshalJSON convert JSON data to struct
type Requester ¶
type Requester interface { // Request should generate an HTTP request from parameters. Request() (*http.Request, error) }
Requester is implemented by any value that has a Request method.
type RequesterFunc ¶
RequesterFunc implements Requester
type Restaurant ¶
type Restaurant struct { ID *int64 `json:"id,string,omitempty"` // ID of the restaurant Name *string `json:"name,omitempty"` // Name of the restaurant URL *string `json:"url,omitempty"` // URL of the restaurant page Location *RestaurantLocation `json:"location,omitempty"` // Restaurant location details // List of cuisines served at the restaurant in csv format Cuisines []string // `json:"cuisines,omitempty"` // Average price of a meal for two people AverageCostForTwo *int64 `json:"average_cost_for_two,omitempty"` // Price bracket of the restaurant (1 being pocket friendly and 4 being the costliest) PriceRange *uint8 `json:"price_range,omitempty"` // Local currency symbol; to be used with price Currency *string `json:"currency,omitempty"` // Restaurant rating details UserRating *UserRating `json:"user_rating,omitempty"` // URL of the low resolution header image of restaurant ThumbnailURL *string `json:"thumb,omitempty"` // URL of the restaurant's photos page PhotosURL *string `json:"photos_url,omitempty"` // URL of the restaurant's menu page MenuURL *string `json:"menu_url,omitempty"` // URL of the high resolution header image of restaurant FeaturedImageURL *string `json:"featured_image,omitempty"` // URL of the restaurant's events page EventsURL *string `json:"events_url,omitempty"` // Short URL of the restaurant page; for use in apps or social shares DeeplinkURL *string `json:"deeplink,omitempty"` OrderURL *string `json:"order_url,omitempty"` OrderDeeplinkURL *string `json:"order_deeplink,omitempty"` BookURL *string `json:"book_url,omitempty"` // Whether the restaurant has online delivery enabled or not HasOnlineDelivery *bool // `json:"has_online_delivery,omitempty"` // Valid only if has_online_delivery = 1; // whether the restaurant is accepting online orders right now IsDeliveringNow *bool // `json:"is_delivering_now,omitempty"` HasTableBooking *bool // `json:"has_table_booking,omitempty"` SwitchToOrderMenu *bool // `json:"switch_to_order_menu,omitempty"` // TODO find their structure Offers []interface{} `json:"offers,omitempty"` EstablishmentTypes []interface{} `json:"establishment_types,omitempty"` // ZomatoEvents are the events available in this restaurant ZomatoEvents []struct { Event *Event `json:"event,omitempty"` } `json:"zomato_events,omitempty"` // APIKey used to make the request APIkey *string `json:"apikey,omitempty"` // R holds restaurant ID's R struct { RestaurantID *int64 `json:"res_id,omitempty"` } `json:"R,omitempty"` // Partner Access fields ReviewsCount *int64 `json:"all_reviews_count,omitempty"` // [Partner access] Number of reviews for the restaurant PhotoCount *int64 `json:"photo_count,omitempty"` // [Partner access] Total number of photos for the restaurant, at max 10 photos for partner access PhoneNumbers *string `json:"phone_numbers,omitempty"` // [Partner access] Restaurant's contact numbers in csv format Photos []Photo `json:"photos,omitempty"` // [Partner access] List of restaurant photos Reviews []Review `json:"all_reviews,omitempty"` // [Partner access] List of restaurant reviews }
Restaurant holds a restaurant details
func (*Restaurant) UnmarshalJSON ¶
func (r *Restaurant) UnmarshalJSON(data []byte) error
UnmarshalJSON convert JSON data to struct
type RestaurantLocation ¶
type RestaurantLocation struct { Address *string `json:"address,omitempty"` // Complete address of the restaurant Locality *string `json:"locality,omitempty"` // Name of the locality City *string `json:"city,omitempty"` // Name of the city CityID *int64 `json:"city_id,omitempty"` Latitude *float64 `json:"latitude,string,omitempty"` // Coordinates of the restaurant Longitude *float64 `json:"longitude,string,omitempty"` // Coordinates of the restaurant Zipcode *int64 // `json:"zipcode,omitempty"` // Zipcode CountryID *int64 `json:"country_id,omitempty"` // ID of the country LocalityVerbose *string `json:"locality_verbose,omitempty"` }
RestaurantLocation holds restaurant location details
func (*RestaurantLocation) UnmarshalJSON ¶
func (r *RestaurantLocation) UnmarshalJSON(data []byte) error
UnmarshalJSON convert JSON data to struct
type RestaurantReq ¶
type RestaurantReq struct { // ID of restaurant whose details are requested RestaurantID int64 `url:"res_id" validate:"required"` }
RestaurantReq parameters
type Review ¶
type Review struct { // ID of the review ID *int64 // `json:"id,string,omitempty"` // Rating on scale of 0 to 5 in increments of 0.5 Rating *float64 // `json:"rating,string,omitempty"` // Review text ReviewText *string `json:"review_text,omitempty"` // Color hex code used with the rating on Zomato RatingColor *string `json:"rating_color,omitempty"` // User friendly time string corresponding to time of review posting ReviewTimeFriendly *string `json:"review_time_friendly,omitempty"` // Short description of the rating RatingText *string `json:"rating_text,omitempty"` // Unix timestamp for review_time_friendly Timestamp *time.Time // `json:"timestamp,string,omitempty"` // No of likes received for review Likes *int64 // `json:"likes,string,omitempty"` // User details of author of review User *User `json:"user"` // No of comments on review CommentsCount *int64 // `json:"comments_count,string,omitempty"` }
Review holds review details
func (*Review) UnmarshalJSON ¶
UnmarshalJSON convert JSON data to struct
type ReviewsReq ¶
type ReviewsReq struct { // ID of restaurant whose details are requested RestaurantID int64 `url:"res_id" validate:"required"` // Fetch results after this offset Start uint64 `url:"start,omitempty"` // Max number of results to retrieve Count uint64 `url:"count,omitempty"` }
ReviewsReq parameters
type ReviewsResp ¶
type ReviewsResp struct { ReviewsCount *int64 `json:"reviews_count,omitempty"` ReviewsStart *int64 `json:"reviews_start,omitempty"` ReviewsShown *int64 `json:"reviews_shown,omitempty"` UserReviews []struct { Review *Review `json:"review,omitempty"` } `json:"user_reviews,omitempty"` RespondToReviewsViaZomatoDashboardURL *string `json:"Respond to reviews via Zomato Dashboard,omitempty"` }
ReviewsResp holds reviews for a restaurant
type SearchReq ¶
type SearchReq struct { Query string `url:"q,omitempty"` // search keyword EntityID int64 `url:"entity_id,omitempty"` // location id EntityType EntityType `url:"entity_type,omitempty"` // location type Latitude float64 `url:"lat,omitempty"` // latitude Longitude float64 `url:"lon,omitempty"` // longitude // Fetch results after this offset Start uint64 `url:"start,omitempty"` // Max number of results to retrieve Count uint64 `url:"count,omitempty"` // radius around (lat,lon); to define search area, defined in meters(M) Radius float64 `url:"radius,omitempty"` // establishment id obtained from establishments call Establishment string `url:"establishment_type,omitempty"` // list of cuisine id's separated by comma Cuisines []string `url:"cuisines,omitempty"` // collection id obtained from collections call Collection string `url:"collection_id,omitempty"` // category ids obtained from categories call Category string `url:"category,omitempty"` // sort restaurants by ... Sort Sort `url:"sort,omitempty"` // used with 'sort' parameter to define ascending or descending Order Order `url:"order,omitempty"` }
SearchReq parameters
type SearchResp ¶
type SearchResp struct { // Number of results found ResultsFound int64 `json:"results_found,omitempty"` // The starting location within results from which the results were fetched // (used for pagination) ResultsStart int64 `json:"results_start,omitempty"` // The number of results fetched (used for pagination) ResultsShown int64 `json:"results_shown,omitempty"` Restaurants []struct { Restaurant *Restaurant `json:"restaurant,omitempty"` } `json:"restaurants,omitempty"` }
SearchResp holds search response from the search query
type User ¶
type User struct { // User's name Name *string `json:"name,omitempty"` // User's @handle; uniquely identifies a user on Zomato ZomatoHandle *string `json:"zomato_handle,omitempty"` // Text for user's foodie level FoodieLevel *string `json:"foodie_level,omitempty"` // Number to identify user's foodie level; ranges from 0 to 10 FoodieLevelNumber *uint8 `json:"foodie_level_num,omitempty"` // Color hex code used with foodie level on Zomato FoodieColor *string `json:"foodie_color,omitempty"` // URL for user's profile on Zomato ProfileURL *string `json:"profile_url,omitempty"` // short URL for user's profile on Zomato; for use in apps or social sharing ProfileDeeplinkURL *string `json:"profile_deeplink,omitempty"` // URL for user's profile image ProfileImageURL *string `json:"profile_image,omitempty"` }
User holds user details
type UserRating ¶
type UserRating struct { // Restaurant rating on a scale of 0.0 to 5.0 in increments of 0.1 AggregateRating *float64 `json:"aggregate_rating,string,omitempty"` // Short description of the rating RatingText *string `json:"rating_text,omitempty"` // Color hex code used with the rating on Zomato RatingColor *string `json:"rating_color,omitempty"` // Number of ratings received Votes *int64 `json:"votes,string,omitempty"` }
UserRating stores user rating details