# AUTO-GENERATED by scripts/oas-sync emit-resource Food Classification. Do not edit by hand.
"""Resource wrapper for the OAS ``Food Classification`` tag (generated)."""
from __future__ import annotations
from typing import Any, Optional
from .._base import BaseResource
class ClassificationResource(BaseResource):
"""Resource methods for the OAS `Food Classification` tag (generated)."""
[docs]
def brands_get_v1(
self,
starts_with: str,
brand_type: Optional[str] = None,
region: Optional[str] = None,
language: Optional[str] = None,
) -> list:
"""This is a utility method, returning the list of food brands.
:param starts_with: Food brands that begin with the first letter is returned. The "*" will return all food brands beginning with a numeric character. If this is not specified then the most popular food brands at the time is returned
:param brand_type: Either "manufacturer", "restaurant" or "supermarket" (default value is "manufacturer")
:param region: Results will be filtered by region. E.G.: "FR" returns results from France. If not specified this will default to "US" (United States). Click here for full documentation on localization.
:param language: (Ignored unless region is also specified) Results will be in the specified language. E.G.: "fr" returns results in French
:return: Raw FatSecret response shape (no typed model — see ``docs/migration-v3.rst``).
Notes:
food_brands.get (v1). DEPRECATED upstream. Premier-only.
"""
params: dict[str, Any] = {"method": "food_brands.get"}
params["starts_with"] = starts_with
self._client._set_optional(
params,
[
("brand_type", brand_type),
("region", region),
("language", language),
],
)
payload = self._client._call(params)
raw = self._client._unwrap(payload, "food_brands", list_key="food_brand")
return raw
[docs]
def brands_get_v2(
self,
starts_with: str,
brand_type: Optional[str] = None,
region: Optional[str] = None,
language: Optional[str] = None,
) -> list:
"""This is a utility method, returning the list of food brands.
:param starts_with: Food brands that begin with the first letter is returned. The "*" will return all food brands beginning with a numeric character. If this is not specified then the most popular food brands at the time is returned
:param brand_type: Either "manufacturer", "restaurant" or "supermarket" (default value is "manufacturer")
:param region: Results will be filtered by region. E.G.: "FR" returns results from France. If not specified this will default to "US" (United States). Click here for full documentation on localization.
:param language: (Ignored unless region is also specified) Results will be in the specified language. E.G.: "fr" returns results in French
:return: Raw FatSecret response shape (no typed model — see ``docs/migration-v3.rst``).
Notes:
food_brands.get (v2). Premier-only.
"""
params: dict[str, Any] = {"method": "food_brands.get.v2"}
params["starts_with"] = starts_with
self._client._set_optional(
params,
[
("brand_type", brand_type),
("region", region),
("language", language),
],
)
payload = self._client._call(params)
raw = self._client._unwrap(payload, "food_brands", list_key="food_brand")
return raw
[docs]
def categories_get_v1(
self,
region: Optional[str] = None,
language: Optional[str] = None,
) -> list:
"""This is a utility method, returning the full list of all food categories and their associated unique identifiers.
:param region: Results will be filtered by region. E.G.: "FR" returns results from France. If not specified this will default to "US" (United States). Click here for full documentation on localization.
:param language: (Ignored unless region is also specified) Results will be in the specified language. E.G.: "fr" returns results in French
:return: Raw FatSecret response shape (no typed model — see ``docs/migration-v3.rst``).
Notes:
food_categories.get (v1). DEPRECATED upstream. Premier-only.
"""
params: dict[str, Any] = {"method": "food_categories.get"}
self._client._set_optional(
params,
[
("region", region),
("language", language),
],
)
payload = self._client._call(params)
raw = self._client._unwrap(payload, "food_categories", list_key="food_category")
return raw
[docs]
def categories_get_v2(
self,
region: Optional[str] = None,
language: Optional[str] = None,
) -> list:
"""This is a utility method, returning the full list of all food categories and their associated unique identifiers.
:param region: Results will be filtered by region. E.G.: "FR" returns results from France. If not specified this will default to "US" (United States). Click here for full documentation on localization.
:param language: (Ignored unless region is also specified) Results will be in the specified language. E.G.: "fr" returns results in French
:return: Raw FatSecret response shape (no typed model — see ``docs/migration-v3.rst``).
Notes:
food_categories.get (v2). Premier-only.
"""
params: dict[str, Any] = {"method": "food_categories.get.v2"}
self._client._set_optional(
params,
[
("region", region),
("language", language),
],
)
payload = self._client._call(params)
raw = self._client._unwrap(payload, "food_categories", list_key="food_category")
return raw
[docs]
def sub_categories_get_v1(
self,
food_category_id: int,
region: Optional[str] = None,
language: Optional[str] = None,
) -> list:
"""This is a utility method, returning the full list of all food sub categories for a food category.
:param food_category_id: Unique identifier of the food category entry
:param region: Results will be filtered by region. E.G.: "FR" returns results from France. If not specified this will default to "US" (United States). Click here for full documentation on localization.
:param language: (Ignored unless region is also specified) Results will be in the specified language. E.G.: "fr" returns results in French
:return: Raw FatSecret response shape (no typed model — see ``docs/migration-v3.rst``).
Notes:
food_sub_categories.get (v1). DEPRECATED upstream. Premier-only.
"""
params: dict[str, Any] = {"method": "food_sub_categories.get"}
params["food_category_id"] = food_category_id
self._client._set_optional(
params,
[
("region", region),
("language", language),
],
)
payload = self._client._call(params)
raw = self._client._unwrap(payload, "food_sub_categories", list_key="food_sub_category")
return raw
[docs]
def sub_categories_get_v2(
self,
food_category_id: int,
region: Optional[str] = None,
language: Optional[str] = None,
) -> list:
"""This is a utility method, returning the full list of all food sub categories for a food category.
:param food_category_id: Unique identifier of the food category entry
:param region: Results will be filtered by region. E.G.: "FR" returns results from France. If not specified this will default to "US" (United States). Click here for full documentation on localization.
:param language: (Ignored unless region is also specified) Results will be in the specified language. E.G.: "fr" returns results in French
:return: Raw FatSecret response shape (no typed model — see ``docs/migration-v3.rst``).
Notes:
food_sub_categories.get (v2). Premier-only.
"""
params: dict[str, Any] = {"method": "food_sub_categories.get.v2"}
params["food_category_id"] = food_category_id
self._client._set_optional(
params,
[
("region", region),
("language", language),
],
)
payload = self._client._call(params)
raw = self._client._unwrap(payload, "food_sub_categories", list_key="food_sub_category")
return raw
ClassificationResource.__module__ = "fatsecret.resources.classification"
__all__ = ["ClassificationResource"]