Skip to content

Instantly share code, notes, and snippets.

@michaeldmueller
Last active August 3, 2020 12:24
Show Gist options
  • Save michaeldmueller/84d6d0b737bcf5c1c702d1154a1ce966 to your computer and use it in GitHub Desktop.
Save michaeldmueller/84d6d0b737bcf5c1c702d1154a1ce966 to your computer and use it in GitHub Desktop.

Endpoints

getRestaurants()

/restaurants Used for getting an array of all restaurants, organized by category.

Returns

{
  [
    {
      "categoryName": "Fast Food",
      "isFeaturedCategory": false,
      "restaurants": [
        {
          "name": "Burger Village",
          "address": "222 7th Avenue, Brooklyn, NY",
          "lat": 40.670446,
          "lng": -73.978842,
          "displayImage": "http://placekitten.com/200/300"
        },
        { ... },
        { ... }
      ]
    },
    { ... },
    { ... }
  ]
}

getRestaurantDetails()

/restaurant/{id} Used for getting details about a specific restaurant. For example, when a user selects a restaurant on map.

Returns

{
  "name": "Burger Village",
  "address": "222 7th Avenue, Brooklyn, NY",
  "lat": 40.670446,
  "lng": -73.978842,
  "isFeatured": false,
  "displayImages": [
    "http://placekitten.com/200/300",
    "http://placekitten.com/200/300"
  ]
  "phoneNumber": "555-555-5555",
  "websiteURL": "https://www.burgervillage.com/",
  "details": "Lorem ipsum ....".
  "shareLink": "https://www.foodiecard.com/our-restaurants/burger-village2",
  "videoURL": "https://www.youtube.com/watch?v=....",
  "tags": ["Breakfast","Bagels"],
  "price": 1
}

Models

RestaurantCategoryResponse

categoryName: String - Category name (ex: "Fast Food")

isFeaturedCategory: Bool - If true, is the "featured" category

restaurants: [RestaurantResponse] - List of all Restaurants in this category

RestaurantResponse

name: String

address: String

lat: Double - Used to localize the restaurant address. Could be omitted in exchange for iOS built-in geocoder, but if data is already stored would be a lot easier to just pass coordinates

lng: Double - Same as lat

isFeatured: Bool - Used to display "Featured" badge over restaurant

displayImage: String? - URL for the display image

RestaurantDetailsResponse

name: String

address: String

lat: Double

lng: Double

isFeatured: Bool

displayImages: [String] - List of restaurant photo URLs. Used to display slide show

phoneNumber: String? - Optional phone number

websiteURL: String? - Optional website URL

details: String

shareLink: String? - Link for sharing the restaurant

videoURL: String? - Optional video URL

tags: [String] - Tags used to categorize the restaurant

price: Int - Used to display price of restaurant (1-3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment