# 自行車 (https://nolantw.github.io/tdx/reference/bike/)

## `Bike`

### `stations`

```python
def stations(
    city: City | str,
    *,
    station_uid: str | None = None,
    query: Query[BikeStation] | QueryParams | None = None,
    limit: int | None = None,
    offset: int = 0,
    cache_ttl: float | None = None,
) -> Records[BikeStation]
```

取得租借站點，可指定站點 UID。

### `availability`

```python
def availability(
    city: City | str,
    *,
    station_uid: str | None = None,
    query: Query[BikeAvailability] | QueryParams | None = None,
    limit: int | None = None,
    offset: int = 0,
    cache_ttl: float | None = None,
) -> Records[BikeAvailability]
```

取得即時可借與可還數量。

### `cycling_routes`

```python
def cycling_routes(
    city: City | str,
    *,
    query: Query[CyclingRoute] | QueryParams | None = None,
    limit: int | None = None,
    offset: int = 0,
    cache_ttl: float | None = None,
) -> Records[CyclingRoute]
```

取得縣市的自行車道與線型。

## `BikeStation`

```python
class BikeStation(BaseModel):
    uid: str
    id: str
    authority_id: str | None
    name: Name
    position: MaybePosition
    address: Name | None
    capacity: int
    service_type: int
    source_updated_at: MaybeTimestamp
    updated_at: Timestamp
    stop_description: str | None
```

## `BikeRentalCounts`

```python
class BikeRentalCounts(BaseModel):
    general: int | None
    electric: int | None
```

## `BikeAvailability`

```python
class BikeAvailability(BaseModel):
    uid: str
    id: str
    service_status: int
    service_type: int
    available_to_rent: int
    available_to_return: int
    rental_counts: BikeRentalCounts | None
    source_updated_at: MaybeTimestamp
    updated_at: Timestamp
```

## `CyclingRoute`

```python
class CyclingRoute(BaseModel):
    name: str
    city_code: str
    city: str | None
    town: str | None
    start: str | None
    end: str | None
    length_meters: float | None
    finished_time: str | None
    geometry: str
    encoded_polyline: str | None
    updated_at: Timestamp
    authority_name: str | None
    direction: str | None
    cycling_type: str | None
```