town6.api ========= .. py:module:: town6.api Classes ------- .. autoapisummary:: town6.api.MeetingApiEndpoint town6.api.PoliticalBusinessApiEndpoint town6.api.ParliamentarianApiEndpoint town6.api.CommissionApiEndpoint town6.api.ParliamentaryGroupApiEndpoint Module Contents --------------- .. py:class:: MeetingApiEndpoint(request: onegov.core.request.CoreRequest, extra_parameters: dict[str, list[str]] | None = None, page: int | None = None) Bases: :py:obj:`onegov.api.models.ApiEndpoint`\ [\ :py:obj:`onegov.org.models.meeting.Meeting`\ , :py:obj:`uuid.UUID`\ ] An API endpoint. API endpoints wrap collection and do some filter mapping. To add a new endpoint, inherit from this class and provide the missing functions and properties at the bottom. Note that the collection is expected to be to provide the functionality of ``onegov.core.collection.Pagination``. .. py:attribute:: app :type: onegov.town6.TownApp .. py:attribute:: request :type: onegov.town6.request.TownRequest .. py:attribute:: endpoint :value: 'meetings' .. py:attribute:: pk_type .. py:property:: title :type: str A human readable title for this endpoint. .. py:property:: collection :type: onegov.org.api.PaginatedCollection[onegov.org.models.meeting.Meeting, uuid.UUID] An instance of the collection with filters and page set. .. py:method:: item_data(item: onegov.org.models.meeting.Meeting) -> dict[str, Any] Return the data properties of the collection item as a dictionary. For example:: { 'name': 'Paul', 'age': 40 } .. py:method:: item_links(item: onegov.org.models.meeting.Meeting) -> dict[str, Any] Return the link properties of the collection item as a dictionary. Links can either be string or a linkable object. For example:: { 'website': 'https://onegov.ch', 'friends': FriendsApiEndpoint(app).for_item(paul), 'home': ApiEndpointCollection(app) } .. py:class:: PoliticalBusinessApiEndpoint(request: onegov.core.request.CoreRequest, extra_parameters: dict[str, list[str]] | None = None, page: int | None = None) Bases: :py:obj:`onegov.api.models.ApiEndpoint`\ [\ :py:obj:`onegov.org.models.political_business.PoliticalBusiness`\ , :py:obj:`uuid.UUID`\ ] An API endpoint. API endpoints wrap collection and do some filter mapping. To add a new endpoint, inherit from this class and provide the missing functions and properties at the bottom. Note that the collection is expected to be to provide the functionality of ``onegov.core.collection.Pagination``. .. py:attribute:: app :type: onegov.town6.TownApp .. py:attribute:: request :type: onegov.town6.request.TownRequest .. py:attribute:: endpoint :value: 'political_businesses' .. py:attribute:: pk_type .. py:property:: title :type: str A human readable title for this endpoint. .. py:property:: collection :type: onegov.org.models.political_business.PoliticalBusinessCollection An instance of the collection with filters and page set. .. py:method:: item_data(item: onegov.org.models.political_business.PoliticalBusiness) -> dict[str, Any] Return the data properties of the collection item as a dictionary. For example:: { 'name': 'Paul', 'age': 40 } .. py:method:: item_links(item: onegov.org.models.political_business.PoliticalBusiness) -> dict[str, Any] Return the link properties of the collection item as a dictionary. Links can either be string or a linkable object. For example:: { 'website': 'https://onegov.ch', 'friends': FriendsApiEndpoint(app).for_item(paul), 'home': ApiEndpointCollection(app) } .. py:class:: ParliamentarianApiEndpoint(request: onegov.core.request.CoreRequest, extra_parameters: dict[str, list[str]] | None = None, page: int | None = None) Bases: :py:obj:`onegov.api.models.ApiEndpoint`\ [\ :py:obj:`onegov.org.models.parliament.RISParliamentarian`\ , :py:obj:`uuid.UUID`\ ] An API endpoint. API endpoints wrap collection and do some filter mapping. To add a new endpoint, inherit from this class and provide the missing functions and properties at the bottom. Note that the collection is expected to be to provide the functionality of ``onegov.core.collection.Pagination``. .. py:attribute:: app :type: onegov.town6.TownApp .. py:attribute:: request :type: onegov.town6.request.TownRequest .. py:attribute:: endpoint :value: 'parliamentarians' .. py:attribute:: pk_type .. py:property:: title :type: str A human readable title for this endpoint. .. py:property:: collection :type: onegov.org.api.PaginatedCollection[onegov.org.models.parliament.RISParliamentarian, uuid.UUID] An instance of the collection with filters and page set. .. py:method:: item_data(item: onegov.org.models.parliament.RISParliamentarian) -> dict[str, Any] Return the data properties of the collection item as a dictionary. For example:: { 'name': 'Paul', 'age': 40 } .. py:method:: item_links(item: onegov.org.models.parliament.RISParliamentarian) -> dict[str, Any] Return the link properties of the collection item as a dictionary. Links can either be string or a linkable object. For example:: { 'website': 'https://onegov.ch', 'friends': FriendsApiEndpoint(app).for_item(paul), 'home': ApiEndpointCollection(app) } .. py:class:: CommissionApiEndpoint(request: onegov.core.request.CoreRequest, extra_parameters: dict[str, list[str]] | None = None, page: int | None = None) Bases: :py:obj:`onegov.api.models.ApiEndpoint`\ [\ :py:obj:`onegov.org.models.parliament.RISCommission`\ , :py:obj:`uuid.UUID`\ ] An API endpoint. API endpoints wrap collection and do some filter mapping. To add a new endpoint, inherit from this class and provide the missing functions and properties at the bottom. Note that the collection is expected to be to provide the functionality of ``onegov.core.collection.Pagination``. .. py:attribute:: app :type: onegov.town6.TownApp .. py:attribute:: request :type: onegov.town6.request.TownRequest .. py:attribute:: endpoint :value: 'commissions' .. py:attribute:: pk_type .. py:property:: title :type: str A human readable title for this endpoint. .. py:property:: collection :type: onegov.org.api.PaginatedCollection[onegov.org.models.parliament.RISCommission, uuid.UUID] An instance of the collection with filters and page set. .. py:method:: item_data(item: onegov.org.models.parliament.RISCommission) -> dict[str, Any] Return the data properties of the collection item as a dictionary. For example:: { 'name': 'Paul', 'age': 40 } .. py:method:: item_links(item: onegov.org.models.parliament.RISCommission) -> dict[str, Any] Return the link properties of the collection item as a dictionary. Links can either be string or a linkable object. For example:: { 'website': 'https://onegov.ch', 'friends': FriendsApiEndpoint(app).for_item(paul), 'home': ApiEndpointCollection(app) } .. py:class:: ParliamentaryGroupApiEndpoint(request: onegov.core.request.CoreRequest, extra_parameters: dict[str, list[str]] | None = None, page: int | None = None) Bases: :py:obj:`onegov.api.models.ApiEndpoint`\ [\ :py:obj:`onegov.org.models.parliament.RISParliamentaryGroup`\ , :py:obj:`uuid.UUID`\ ] An API endpoint. API endpoints wrap collection and do some filter mapping. To add a new endpoint, inherit from this class and provide the missing functions and properties at the bottom. Note that the collection is expected to be to provide the functionality of ``onegov.core.collection.Pagination``. .. py:attribute:: app :type: onegov.town6.TownApp .. py:attribute:: request :type: onegov.town6.request.TownRequest .. py:attribute:: endpoint :value: 'parliamentary_groups' .. py:attribute:: pk_type .. py:property:: title :type: str A human readable title for this endpoint. .. py:property:: collection :type: onegov.org.api.PaginatedCollection[onegov.org.models.parliament.RISParliamentaryGroup, uuid.UUID] An instance of the collection with filters and page set. .. py:method:: item_data(item: onegov.org.models.parliament.RISParliamentaryGroup) -> dict[str, Any] Return the data properties of the collection item as a dictionary. For example:: { 'name': 'Paul', 'age': 40 } .. py:method:: item_links(item: onegov.org.models.parliament.RISParliamentaryGroup) -> dict[str, Any] Return the link properties of the collection item as a dictionary. Links can either be string or a linkable object. For example:: { 'website': 'https://onegov.ch', 'friends': FriendsApiEndpoint(app).for_item(paul), 'home': ApiEndpointCollection(app) }