Skip to content

Powertrain Type Config API Client

Bases: BasePowertrainAPIClient

Powertrain Type Config API Client.

Swagger Documentation

Source code in reportconnectors/api_client/powertrain/type_config/__init__.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
class PowertrainTypeConfigAPIClient(BasePowertrainAPIClient):
    """
    Powertrain Type Config API Client.

    [Swagger Documentation](https://motion-pt-dev-we-type-config-api.azurewebsites.net/swagger/index.html)
    """

    _status_prefix = "/type-config"

    def get_unit_conversions(self) -> UnitConversionsResponse:
        """
        Gets all unit conversion data in a single response.
        Uses `/typeconfig/unitconversions` endpoint

        Returns:
            All unit conversion data in a single response
        """
        endpoint = "api/report/TypeConfig/Report/TypeConfig/UnitConversions"
        response = self._make_request(method="GET", endpoint=endpoint)
        response_model = self._decode_response_to_model(response, UnitConversionsResponse)
        return response_model

    def get_bearing_info(self, bearing_no: str, manufacturer: Optional[str] = None) -> BearingInfoResponse:
        """
        Gets the collection bearing info data that matches the provided `bearing_no` and `manufacturer` name.
        Uses `/assetType/bearingInfo/` endpoint

        Args:
            bearing_no: Bearing type number / identifier.
            manufacturer: Bearing manufacturer name. If not provided, all manufacturers are considered.

        Returns:
            Bearing Info data response
        """
        endpoint = f"api/report/TypeConfig/Report/AssetType/BearingInfo/{bearing_no}"
        params = {"manufacturer": manufacturer} if manufacturer else None
        response = self._make_request(method="GET", endpoint=endpoint, params=params)
        response_model = self._decode_response_to_model(response, BearingInfoResponse)
        return response_model

get_bearing_info(bearing_no, manufacturer=None)

Gets the collection bearing info data that matches the provided bearing_no and manufacturer name. Uses /assetType/bearingInfo/ endpoint

Parameters:

Name Type Description Default
bearing_no str

Bearing type number / identifier.

required
manufacturer Optional[str]

Bearing manufacturer name. If not provided, all manufacturers are considered.

None

Returns:

Type Description
BearingInfoResponse

Bearing Info data response

Source code in reportconnectors/api_client/powertrain/type_config/__init__.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
def get_bearing_info(self, bearing_no: str, manufacturer: Optional[str] = None) -> BearingInfoResponse:
    """
    Gets the collection bearing info data that matches the provided `bearing_no` and `manufacturer` name.
    Uses `/assetType/bearingInfo/` endpoint

    Args:
        bearing_no: Bearing type number / identifier.
        manufacturer: Bearing manufacturer name. If not provided, all manufacturers are considered.

    Returns:
        Bearing Info data response
    """
    endpoint = f"api/report/TypeConfig/Report/AssetType/BearingInfo/{bearing_no}"
    params = {"manufacturer": manufacturer} if manufacturer else None
    response = self._make_request(method="GET", endpoint=endpoint, params=params)
    response_model = self._decode_response_to_model(response, BearingInfoResponse)
    return response_model

get_unit_conversions()

Gets all unit conversion data in a single response. Uses /typeconfig/unitconversions endpoint

Returns:

Type Description
UnitConversionsResponse

All unit conversion data in a single response

Source code in reportconnectors/api_client/powertrain/type_config/__init__.py
20
21
22
23
24
25
26
27
28
29
30
31
def get_unit_conversions(self) -> UnitConversionsResponse:
    """
    Gets all unit conversion data in a single response.
    Uses `/typeconfig/unitconversions` endpoint

    Returns:
        All unit conversion data in a single response
    """
    endpoint = "api/report/TypeConfig/Report/TypeConfig/UnitConversions"
    response = self._make_request(method="GET", endpoint=endpoint)
    response_model = self._decode_response_to_model(response, UnitConversionsResponse)
    return response_model