Source code for fatsecret.resources._generated.exercises

# AUTO-GENERATED by scripts/oas-sync emit-resource Exercise Diary. Do not edit by hand.
"""Resource wrapper for the OAS ``Exercise Diary`` tag (generated)."""

from __future__ import annotations

from typing import Any, Optional

from .._base import BaseResource


class ExercisesResource(BaseResource):
    """Resource methods for the OAS `Exercise Diary` tag (generated)."""

[docs] def entries_commit_day_v1( self, date: Optional[int] = None, ) -> bool: """exercise_entries.commit_day (v1). Premier-only.""" params: dict[str, Any] = {"method": "exercise_entries.commit_day"} self._client._set_optional( params, [ ("date", None if date is None else self._client.unix_time_v2(date)), ], ) payload = self._client._call(params, method="POST") return self._client._mutator_success(payload)
[docs] def entries_get_month_v1( self, date: Optional[int] = None, ) -> list: """exercise_entries.get_month (v1). DEPRECATED upstream. Premier-only.""" params: dict[str, Any] = {"method": "exercise_entries.get_month"} self._client._set_optional( params, [ ("date", None if date is None else self._client.unix_time_v2(date)), ], ) payload = self._client._call(params) return self._client._unwrap(payload, "month", list_key="day")
[docs] def entries_get_month_v2( self, date: Optional[int] = None, ) -> list: """exercise_entries.get_month (v2). Premier-only.""" params: dict[str, Any] = {"method": "exercise_entries.get_month.v2"} self._client._set_optional( params, [ ("date", None if date is None else self._client.unix_time_v2(date)), ], ) payload = self._client._call(params) return self._client._unwrap(payload, "month", list_key="day")
[docs] def entries_get_v1( self, date: Optional[int] = None, ) -> list: """exercise_entries.get (v1). DEPRECATED upstream. Premier-only.""" params: dict[str, Any] = {"method": "exercise_entries.get"} self._client._set_optional( params, [ ("date", None if date is None else self._client.unix_time_v2(date)), ], ) payload = self._client._call(params) return self._client._unwrap(payload, "exercise_entries", list_key="exercise_entry")
[docs] def entries_get_v2( self, date: Optional[int] = None, ) -> list: """exercise_entries.get (v2). Premier-only.""" params: dict[str, Any] = {"method": "exercise_entries.get.v2"} self._client._set_optional( params, [ ("date", None if date is None else self._client.unix_time_v2(date)), ], ) payload = self._client._call(params) return self._client._unwrap(payload, "exercise_entries", list_key="exercise_entry")
def entries_save_template_v1( self, days: int, date: Optional[int] = None, ) -> bool: """exercise_entries.save_template (v1). Premier-only.""" params: dict[str, Any] = {"method": "exercise_entries.save_template"} params["days"] = days self._client._set_optional( params, [ ("date", None if date is None else self._client.unix_time_v2(date)), ], ) payload = self._client._call(params, method="POST") return self._client._mutator_success(payload)
[docs] def entry_edit_v1( self, shift_to_id: int, shift_from_id: int, minutes: int, date: Optional[int] = None, shift_to_name: Optional[str] = None, shift_from_name: Optional[str] = None, kcal: Optional[int] = None, ) -> bool: """exercise_entry.edit (v1). Premier-only.""" params: dict[str, Any] = {"method": "exercise_entry.edit"} params["shift_to_id"] = shift_to_id params["shift_from_id"] = shift_from_id params["minutes"] = minutes self._client._set_optional( params, [ ("date", None if date is None else self._client.unix_time_v2(date)), ("shift_to_name", shift_to_name), ("shift_from_name", shift_from_name), ("kcal", kcal), ], ) payload = self._client._call(params, method="PUT") return self._client._mutator_success(payload)
[docs] def list_v1( self, region: Optional[str] = None, language: Optional[str] = None, ) -> list: """exercises.get (v1). DEPRECATED upstream. Premier-only.""" params: dict[str, Any] = {"method": "exercises.get"} self._client._set_optional( params, [ ("region", region), ("language", language), ], ) payload = self._client._call(params) return self._client._unwrap(payload, "exercise_types", list_key="exercise")
[docs] def list_v2( self, region: Optional[str] = None, language: Optional[str] = None, ) -> list: """exercises.get (v2). Premier-only.""" params: dict[str, Any] = {"method": "exercises.get.v2"} self._client._set_optional( params, [ ("region", region), ("language", language), ], ) payload = self._client._call(params) return self._client._unwrap(payload, "exercise_types", list_key="exercise")
__all__ = ["ExercisesResource"]