town6.api

Classes

MeetingApiEndpoint

An API endpoint.

PoliticalBusinessApiEndpoint

An API endpoint.

ParliamentarianApiEndpoint

An API endpoint.

CommissionApiEndpoint

An API endpoint.

ParliamentaryGroupApiEndpoint

An API endpoint.

Module Contents

class town6.api.MeetingApiEndpoint(request: onegov.core.request.CoreRequest, extra_parameters: dict[str, list[str]] | None = None, page: int | None = None)[source]

Bases: onegov.api.models.ApiEndpoint[onegov.org.models.meeting.Meeting]

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.

app: onegov.town6.TownApp[source]
request: onegov.town6.request.TownRequest[source]
endpoint = 'meetings'[source]
property title: str[source]

Return a human readable title for this endpoint

property collection: onegov.org.api.PaginatedCollection[onegov.org.models.meeting.Meeting][source]

Return an instance of the collection with filters and page set.

item_data(item: onegov.org.models.meeting.Meeting) dict[str, Any][source]

Return the data properties of the collection item as a dictionary.

For example:

{
    'name': 'Paul',
    'age': 40
}

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)
}
class town6.api.PoliticalBusinessApiEndpoint(request: onegov.core.request.CoreRequest, extra_parameters: dict[str, list[str]] | None = None, page: int | None = None)[source]

Bases: onegov.api.models.ApiEndpoint[onegov.org.models.political_business.PoliticalBusiness]

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.

app: onegov.town6.TownApp[source]
request: onegov.town6.request.TownRequest[source]
endpoint = 'political_businesses'[source]
property title: str[source]

Return a human readable title for this endpoint

property collection: onegov.org.models.political_business.PoliticalBusinessCollection[source]

Return an instance of the collection with filters and page set.

item_data(item: onegov.org.models.political_business.PoliticalBusiness) dict[str, Any][source]

Return the data properties of the collection item as a dictionary.

For example:

{
    'name': 'Paul',
    'age': 40
}

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)
}
class town6.api.ParliamentarianApiEndpoint(request: onegov.core.request.CoreRequest, extra_parameters: dict[str, list[str]] | None = None, page: int | None = None)[source]

Bases: onegov.api.models.ApiEndpoint[onegov.org.models.parliament.RISParliamentarian]

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.

app: onegov.town6.TownApp[source]
request: onegov.town6.request.TownRequest[source]
endpoint = 'parliamentarians'[source]
property title: str[source]

Return a human readable title for this endpoint

property collection: onegov.org.api.PaginatedCollection[onegov.org.models.parliament.RISParliamentarian][source]

Return an instance of the collection with filters and page set.

item_data(item: onegov.org.models.parliament.RISParliamentarian) dict[str, Any][source]

Return the data properties of the collection item as a dictionary.

For example:

{
    'name': 'Paul',
    'age': 40
}

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)
}
class town6.api.CommissionApiEndpoint(request: onegov.core.request.CoreRequest, extra_parameters: dict[str, list[str]] | None = None, page: int | None = None)[source]

Bases: onegov.api.models.ApiEndpoint[onegov.org.models.parliament.RISCommission]

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.

app: onegov.town6.TownApp[source]
request: onegov.town6.request.TownRequest[source]
endpoint = 'commissions'[source]
property title: str[source]

Return a human readable title for this endpoint

property collection: onegov.org.api.PaginatedCollection[onegov.org.models.parliament.RISCommission][source]

Return an instance of the collection with filters and page set.

item_data(item: onegov.org.models.parliament.RISCommission) dict[str, Any][source]

Return the data properties of the collection item as a dictionary.

For example:

{
    'name': 'Paul',
    'age': 40
}

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)
}
class town6.api.ParliamentaryGroupApiEndpoint(request: onegov.core.request.CoreRequest, extra_parameters: dict[str, list[str]] | None = None, page: int | None = None)[source]

Bases: onegov.api.models.ApiEndpoint[onegov.org.models.parliament.RISParliamentaryGroup]

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.

app: onegov.town6.TownApp[source]
request: onegov.town6.request.TownRequest[source]
endpoint = 'parliamentary_groups'[source]
property title: str[source]

Return a human readable title for this endpoint

property collection: onegov.org.api.PaginatedCollection[onegov.org.models.parliament.RISParliamentaryGroup][source]

Return an instance of the collection with filters and page set.

item_data(item: onegov.org.models.parliament.RISParliamentaryGroup) dict[str, Any][source]

Return the data properties of the collection item as a dictionary.

For example:

{
    'name': 'Paul',
    'age': 40
}

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)
}