Skip to content

Commit dd54ffb

Browse files
authored
Merge pull request #2 from chompfoods/SWAGGERHUB
Swaggerhub
2 parents 9483b77 + 7b9ef0c commit dd54ffb

16 files changed

+1308
-2058
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
entry_points={
2929
'console_scripts': ['swagger_server=swagger_server.__main__:main']},
3030
long_description="""\
31-
__Important:__ - An __[API key](https://chompthis.com/api/)__ is required for access to this API. - Get yours at __[https://chompthis.com/api](https://chompthis.com/api/)__. ----- __Getting Started:__ - __[Subscribe](https://chompthis.com/api/#pricing)__ to the API. - Scroll down and click the \"__Authorize__\" button. - Enter your API key into the \"__value__\" input, click the \"__Authorize__\" button, then click the \"__Close__\" button. - Scroll down to the section titled \"__default__\" and click on the API endpoint you wish to use. - Click the \"__Try it out__\" button. - Enter the information the endpoint requires. - Click the \"__Execute__\" button. __Example:__ - __[View example](https://raw.githubusercontent.com/chompfoods/examples/master/response-object.json)__ API response object. ----- __How Do I Find My API Key?__ - Your API key was sent to the email address you used to create your subscription. - You will also find your API key in the __[Client Center](https://chompthis.com/api/manage.php)__. - _Read __[this article](https://desk.zoho.com/portal/chompthis/kb/articles/how-do-i-find-my-api-key)__ for more information._ ||| | ------- | -------- | | [Knowledge Base](https://desk.zoho.com/portal/chompthis/kb/chomp) | [Pricing](https://chompthis.com/api/) | | [Attribution](https://chompthis.com/api/docs/attribution.php) | [Cost Calculator](https://chompthis.com/api/cost-calculator.php) | | [Terms & License](https://chompthis.com/api/terms.php) | [Database Search](https://chompthis.com/api/lookup.php) | | [Support](https://chompthis.com/api/ticket-new.php) | [Query Builder](https://chompthis.com/api/build.php) | | [Client Center](https://chompthis.com/api/manage.php) | |
31+
## Important An **[API key](https://chompthis.com/api/)** is required for access to this API. Get yours at **[https://chompthis.com/api](https://chompthis.com/api/)**. ### Getting Started * **[Subscribe](https://chompthis.com/api/#pricing)** to the API. * Scroll down and click the \"**Authorize**\" button. * Enter your API key into the \"**value**\" input, click the \"**Authorize**\" button, then click the \"**Close**\" button. * Scroll down to the section titled \"**default**\" and click on the API endpoint you wish to use. * Click the \"**Try it out**\" button. * Enter the information the endpoint requires. * Click the \"**Execute**\" button. ### Example * Branded food response object: **[View example »](https://raw.githubusercontent.com/chompfoods/examples/master/branded-food-response-object.json)** * Ingredient response object: **[View example »](https://raw.githubusercontent.com/chompfoods/examples/master/ingredient-response-object.json)** * Error response object: **[View example »](https://raw.githubusercontent.com/chompfoods/examples/master/error-response-object.json)** ### How Do I Find My API Key? * Your API key was sent to the email address you used to create your subscription. * You will also find your API key in the **[Client Center](https://chompthis.com/api/manage.php)**. * Read **[this article](https://desk.zoho.com/portal/chompthis/kb/articles/how-do-i-find-my-api-key)** for more information. ### Helpful Links * **Help & Support** * [Knowledge Base »](https://desk.zoho.com/portal/chompthis/kb/chomp) * [Support »](https://chompthis.com/api/ticket-new.php) * [Client Center »](https://chompthis.com/api/manage.php) * **Pricing** * [Subscription Options »](https://chompthis.com/api/) * [Cost Calculator »](https://chompthis.com/api/cost-calculator.php) * **Guidelines** * [Terms & License »](https://chompthis.com/api/terms.php) * [Attribution »](https://chompthis.com/api/docs/attribution.php)
3232
"""
3333
)

swagger_server/controllers/default_controller.py

Lines changed: 28 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,27 @@
99
def food_branded_barcode_php_get(code): # noqa: E501
1010
"""Get a branded food item using a barcode
1111
12-
# Get data for a branded food using the food's UPC/EAN barcode. __Example:__ ```https://chompthis.com/api/v2/food/branded/barcode.php?api_key=API_KEY&code=CODE``` # noqa: E501
12+
## Get data for a branded food using the food's UPC/EAN barcode. **Example** > ```https://chompthis.com/api/v2/food/branded/barcode.php?api_key=API_KEY&code=CODE``` **Tips** * Read our **[Knowledge Base article](https://desk.zoho.com/portal/chompthis/kb/articles/im-having-trouble-getting-matches-for-barcodes-what-can-id-do)** for helpful tips and tricks. # noqa: E501
1313
14-
:param code: UPC/EAN barcode __Example:__ 0842234000988 __Resources:__ [Database search](https://chompthis.com/api/lookup.php) _Read [this article](https://desk.zoho.com/portal/chompthis/kb/articles/im-having-trouble-getting-matches-for-barcodes-what-can-id-do) for tips and tricks._
14+
:param code: #### UPC/EAN barcode **Example** > ```&code=0842234000988```
1515
:type code: str
1616
1717
:rtype: BrandedFoodObject
1818
"""
1919
return 'do some magic!'
2020

2121

22-
def food_branded_id_php_get(id, source=None): # noqa: E501
23-
"""Get a branded food item using an ID number
24-
25-
# Get data for a branded food using Chomp's internal ID number. _Alternatively, set the \"source\" parameter to \"USDA\" and use the food's FDC ID._ __Example:__ ```https://chompthis.com/api/v2/food/branded/id.php?api_key=API_KEY&id=ID``` # noqa: E501
26-
27-
:param id: Chomp branded food ID. _Set \"source=USDA\" if you wish to pass in the food's FoodData Central ID (fdc_id)._ __Example #1:__ 15 __Resources:__ [Find branded food IDs](https://chompthis.com/api/lookup.php)
28-
:type id: int
29-
:param source: Specify the data source (optional). You must pass in \"USDA\" if you want to look up a food item using a USDA FDC ID. __Example:__ USDA _(defaults to \"Chomp\")_
30-
:type source: str
31-
32-
:rtype: BrandedFoodObject
33-
"""
34-
return 'do some magic!'
35-
36-
37-
def food_branded_name_php_get(name, limit=None): # noqa: E501
22+
def food_branded_name_php_get(name, limit=None, page=None): # noqa: E501
3823
"""Get a branded food item by name
3924
40-
# Search for branded food items by name. __Example:__ ```https://chompthis.com/api/v2/food/branded/name.php?api_key=API_KEY&name=NAME``` # noqa: E501
25+
## Search for branded food items by name. **Example** > ```https://chompthis.com/api/v2/food/branded/name.php?api_key=API_KEY&name=NAME``` **Tips** * Get started by using our **[food lookup tool](https://chompthis.com/api/lookup.php)**. > This API endpoint is only available to Standard and Premium API subscribers. Please consider upgrading your subscription if you are subscribed to the Limited plan. **[Read this](https://desk.zoho.com/portal/chompthis/kb/articles/can-i-upgrade-downgrade-my-subscription)** if you aren't sure how to upgrade your subscription. # noqa: E501
4126
42-
:param name: Branded food name __Example:__ Starburst __Resources:__ [Find branded food names](https://chompthis.com/api/lookup.php)
27+
:param name: #### Search for branded food items using a general food name keyword. This does not have to exactly match the \"official\" name for the food. **Example** > ```&name=Starburst```
4328
:type name: str
44-
:param limit: Set maximum number of records you want the API to return. ___Note:__ The maximum value is 10._ __Example:__ 3 _(defaults to 10)_
29+
:param limit: #### Set maximum number of records you want the API to return. The default value is \"**10**.\" **Example** > ```&limit=10```
4530
:type limit: int
31+
:param page: #### This is how you paginate the search result. By default, you will see the first 10 records. You must increment the page number to access the next 10 records, and so on. The default value is \"**1**.\" **Example** > ```&page=1```
32+
:type page: int
4633
4734
:rtype: BrandedFoodObject
4835
"""
@@ -52,54 +39,50 @@ def food_branded_name_php_get(name, limit=None): # noqa: E501
5239
def food_branded_search_php_get(allergen=None, brand=None, category=None, country=None, diet=None, ingredient=None, keyword=None, mineral=None, nutrient=None, palm_oil=None, trace=None, vitamin=None, limit=None, page=None): # noqa: E501
5340
"""Get data for branded food items using various search parameters
5441
55-
# Search for branded food items using various parameters. __Example:__ ```https://chompthis.com/api/v2/food/branded/search.php?api_key=API_KEY&brand=BRAND&country=COUNTRY&page=1``` ___Tip:__ Get started by using the [Query Builder](https://chompthis.com/api/build.php)._ # noqa: E501
42+
## Search for branded food items using various parameters. **Example** > ```https://chompthis.com/api/v2/food/branded/search.php?api_key=API_KEY&brand=BRAND&country=COUNTRY&page=1``` **Tips** * Get started by using the **[Query Builder](https://chompthis.com/api/build.php)**. > This API endpoint is only available to Standard and Premium API subscribers. Please consider upgrading your subscription if you are subscribed to the Limited plan. **[Read this](https://desk.zoho.com/portal/chompthis/kb/articles/can-i-upgrade-downgrade-my-subscription)** if you aren't sure how to upgrade your subscription. # noqa: E501
5643
57-
:param allergen: Specify a required allergen ingredient (optional) __Example__: Peanuts __Resources__: [List of allergens](https://chompthis.com/api/data/allergen.php)
44+
:param allergen: #### Filter the search to only include branded foods that contain a specific allergen. **Example** > ```&allergen=Peanuts``` **Important Note**: This parameter cannot be used alone. It must be paired with at least 1 additional parameter.
5845
:type allergen: str
59-
:param brand: Specify a required brand (optional) __Example__: Starbucks __Resources__: [List of brands](https://chompthis.com/api/data/brand.php)
46+
:param brand: #### Filter the search to only include branded foods that are owned by a specific brand. **Example** > ```&brand=Starbucks```
6047
:type brand: str
61-
:param category: Specify a required category (optional) __Example__: Pasta Dishes __Resources__: [List of categories](https://chompthis.com/api/data/category.php)
48+
:param category: #### Filter the search to only include branded foods from a specific category. **Example** > ```&category=Plant Based Foods```
6249
:type category: str
63-
:param country: Specify a required country (optional) __Example__: United States __Resources__: [List of countries](https://chompthis.com/api/data/country.php)
50+
:param country: #### Filter the search to only include branded foods that are sold in a specific country. **Example** > ```&country=United States``` **Important Note**: This parameter cannot be used alone. It must be paired with at least 1 additional parameter.
6451
:type country: str
65-
:param diet: Specify a required diet (optional) _Filters the search to only include food items that are considered compatible with the following diets: Vegan, Vegetarian, Gluten Free_ __Example__: Gluten Free __Resources__: [List of diets](https://chompthis.com/api/data/lifestyle.php)
52+
:param diet: #### Filter the search to only include branded foods that are considered compatible with a specific diet. **Important Note**: This parameter cannot be used alone. It must be paired with at least 1 additional parameter.
6653
:type diet: str
67-
:param ingredient: Specify a required ingredient (optional) __Example__: Salt __Resources__: [List of ingredients](https://chompthis.com/api/data/ingredient.php)
54+
:param ingredient: #### Filter the search to only include branded foods that contain a specific ingredient. **Example** > ```&ingredient=Salt```
6855
:type ingredient: str
69-
:param keyword: Specify a required keyword (optional) __Example__: Starbucks __Resources__: [List of brands](https://chompthis.com/api/data/brand.php)
56+
:param keyword: #### Filter the search to only include branded foods that are associated with a specific keyword. **Example** > ```&keyword=Organic``` **Important Note**: This parameter cannot be used alone. It must be paired with at least 1 additional parameter.
7057
:type keyword: str
71-
:param mineral: Specify a required mineral (optional) __Example__: Potassium __Resources__: [List of minerals](https://chompthis.com/api/data/mineral.php)
58+
:param mineral: #### Filter the search to only include branded foods that contain a specific mineral. **Example** > ```&mineral=Potassium```
7259
:type mineral: str
73-
:param nutrient: Specify a required nutrition label item (optional) __Example__: Caffeine __Resources__: [List of nutrition label items](https://chompthis.com/api/data/nutrition.php)
60+
:param nutrient: #### Filter the search to only include branded foods that contain a specific nutrient. **Example** > ```&nutrient=Caffeine``` **Important Note**: This parameter cannot be used alone. It must be paired with at least 1 additional parameter.
7461
:type nutrient: str
75-
:param palm_oil: Specify a required palm oil ingredient (optional) __Example__: E160a Beta Carotene __Resources__: [List of palm oil ingredients](https://chompthis.com/api/data/palm-oil.php)
62+
:param palm_oil: #### Filter the search to only include branded foods that contain a specific ingredient made using palm oil. **Example** > ```&palm_oil=E160a Beta Carotene```
7663
:type palm_oil: str
77-
:param trace: Specify a required trace ingredient (optional) __Example__: Tree Nuts __Resources__: [List of trace ingredients](https://chompthis.com/api/data/trace.php)
64+
:param trace: ### Filter the search to only include branded foods that contain a specific trace ingredient. **Example** > ```&trace=Tree Nuts``` **Important Note**: This parameter cannot be used alone. It must be paired with at least 1 additional parameter.
7865
:type trace: str
79-
:param vitamin: Specify a required vitamin (optional) __Example__: Biotin __Resources__: [List of vitamins](https://chompthis.com/api/data/vitamin.php)
66+
:param vitamin: #### Filter the search to only include branded foods that contain a specific vitamin. **Example** > ```&vitamin=Biotin```
8067
:type vitamin: str
81-
:param limit: Set maximum number of records you want the API to return. ___Note:__ The maximum value is 10._ __Example:__ 3 _(defaults to 10)_
68+
:param limit: #### Set maximum number of records you want the API to return. The default value is \"**10**.\" **Example** > ```&limit=10```
8269
:type limit: int
83-
:param page: Specify the search response page number. _Each page will contain up to 10 items._ __Example__: 1 _(default)_
70+
:param page: #### This is how you paginate the search result. By default, you will see the first 10 records. You must increment the page number to access the next 10 records, and so on. The default value is \"**1**.\" **Example** > ```&page=1```
8471
:type page: int
8572
8673
:rtype: BrandedFoodObject
8774
"""
8875
return 'do some magic!'
8976

9077

91-
def ingredient_search_php_get(find, list, raw=None, limit=None): # noqa: E501
78+
def food_ingredient_search_php_get(find, limit=None): # noqa: E501
9279
"""Get raw/generic food ingredient item(s)
9380
94-
# Get data for a specific ingredient or a specific set of ingredients. __Example:__ ```https://chompthis.com/api/v2/ingredient/search.php?api_key=API_KEY&find=STRING/LIST&list=BOOLEAN&raw=BOOLEAN``` # noqa: E501
81+
## Get data for a specific ingredient or a specific set of ingredients. **Example #1: Single Ingredient** > ```https://chompthis.com/api/v2/ingredient/search.php?api_key=API_KEY&find=raw broccoli``` **Example #2: Set of Ingredients** > ```https://chompthis.com/api/v2/ingredient/search.php?api_key=API_KEY&find=raw broccoli,mashed potatoes,chicken drumstick``` **Tips** * Expose ingredient endpoints by using our **[food lookup tool](https://chompthis.com/api/lookup.php)**. > This API endpoint is only available to Standard and Premium API subscribers. Please consider upgrading your subscription if you are subscribed to the Limited plan. **[Read this](https://desk.zoho.com/portal/chompthis/kb/articles/can-i-upgrade-downgrade-my-subscription)** if you aren't sure how to upgrade your subscription. # noqa: E501
9582
96-
:param find: Specify the ingredient name(s). __Example #1:__ broccoli __Example #2:__ broccoli,cauliflower,spinach ___Important Note:__ Set the \"is_list\" parameter to true before passing in a comma-separated list of ingredients._
97-
:type find: int
98-
:param list: Specify if you are searching for multiple ingredients. _Setting this to true will configure this endpoint so that it accepts a comma-separated list of ingredients._ _By default, this endpoint expects a single ingredient._ __Example:__ true _(defaults to false)_
99-
:type list: bool
100-
:param raw: Specify if you only want data for raw ingredients. __Example:__ true _(defaults to true)_
101-
:type raw: bool
102-
:param limit: Set maximum number of records you want the API to return. ___Important Note:__ Setting this to \"1\" will return 1 record per search term._ __Example:__ 1 _(defaults to 1, max is 3)_
83+
:param find: Search our database for a single ingredient or a specific set of ingredients. **Example #1: Single Ingredient** > ```&find=raw broccoli``` **Example #2: Set of Ingredients** > ```&find=raw broccoli,buttermilk waffle,mashed potatoes``` **Important Notes** * Comma-separated lists cannot contain more than **10 ingredients**. You must perform additional API calls if you are looking up more than 10 ingredients.
84+
:type find: str
85+
:param limit: #### Set maximum number of records you want the API to return, per search term. The default value is \"**1**.\" **Example** > ```&limit=3```
10386
:type limit: int
10487
10588
:rtype: IngredientObject

0 commit comments

Comments
 (0)