| 
 | 1 | +# This file was automatically generated. DO NOT EDIT.  | 
 | 2 | +# If you have any remark or suggestion do not hesitate to open an issue.  | 
 | 3 | + | 
 | 4 | +from datetime import datetime  | 
 | 5 | +from typing import Optional  | 
 | 6 | + | 
 | 7 | +from scaleway_core.api import API  | 
 | 8 | +from scaleway_core.bridge import (  | 
 | 9 | +    ScwFile,  | 
 | 10 | +    unmarshal_ScwFile,  | 
 | 11 | +)  | 
 | 12 | +from .types import (  | 
 | 13 | +    ProductCategory,  | 
 | 14 | +    ReportType,  | 
 | 15 | +    ServiceCategory,  | 
 | 16 | +    ImpactDataResponse,  | 
 | 17 | +    ImpactReportAvailability,  | 
 | 18 | +    UserApiDownloadImpactReportRequest,  | 
 | 19 | +)  | 
 | 20 | +from .marshalling import (  | 
 | 21 | +    unmarshal_ImpactDataResponse,  | 
 | 22 | +    unmarshal_ImpactReportAvailability,  | 
 | 23 | +    marshal_UserApiDownloadImpactReportRequest,  | 
 | 24 | +)  | 
 | 25 | + | 
 | 26 | + | 
 | 27 | +class EnvironmentalFootprintV1Alpha1UserAPI(API):  | 
 | 28 | +    """  | 
 | 29 | +    Access and download impact reports and impact data for your Scaleway projects. Our API provides key metrics such as estimated carbon emissions and water usage to help monitor your environmental footprint.  | 
 | 30 | +    """  | 
 | 31 | + | 
 | 32 | +    async def get_impact_report_availability(  | 
 | 33 | +        self,  | 
 | 34 | +        *,  | 
 | 35 | +        organization_id: Optional[str] = None,  | 
 | 36 | +        start_date: Optional[datetime] = None,  | 
 | 37 | +        end_date: Optional[datetime] = None,  | 
 | 38 | +    ) -> ImpactReportAvailability:  | 
 | 39 | +        """  | 
 | 40 | +        Get available impact reports.  | 
 | 41 | +        Returns a list of dates of available impact reports.  | 
 | 42 | +        :param organization_id: The UUID of the Organization for which you want to download a report.  | 
 | 43 | +        :param start_date: Start date of the search period (ISO 8601 format, with time in UTC, `YYYY-MM-DDTHH:MM:SSZ`). The date is inclusive.  | 
 | 44 | +        :param end_date: End date of the search period (ISO 8601 format, with time in UTC, `YYYY-MM-DDTHH:MM:SSZ`). The date is exclusive. Defaults to today's date.  | 
 | 45 | +        :return: :class:`ImpactReportAvailability <ImpactReportAvailability>`  | 
 | 46 | +
  | 
 | 47 | +        Usage:  | 
 | 48 | +        ::  | 
 | 49 | +
  | 
 | 50 | +            result = await api.get_impact_report_availability()  | 
 | 51 | +        """  | 
 | 52 | + | 
 | 53 | +        res = self._request(  | 
 | 54 | +            "GET",  | 
 | 55 | +            "/environmental-footprint/v1alpha1/reports/availability",  | 
 | 56 | +            params={  | 
 | 57 | +                "end_date": end_date,  | 
 | 58 | +                "organization_id": organization_id  | 
 | 59 | +                or self.client.default_organization_id,  | 
 | 60 | +                "start_date": start_date,  | 
 | 61 | +            },  | 
 | 62 | +        )  | 
 | 63 | + | 
 | 64 | +        self._throw_on_error(res)  | 
 | 65 | +        return unmarshal_ImpactReportAvailability(res.json())  | 
 | 66 | + | 
 | 67 | +    async def download_impact_report(  | 
 | 68 | +        self,  | 
 | 69 | +        *,  | 
 | 70 | +        organization_id: Optional[str] = None,  | 
 | 71 | +        date: Optional[datetime] = None,  | 
 | 72 | +        type_: Optional[ReportType] = None,  | 
 | 73 | +    ) -> ScwFile:  | 
 | 74 | +        """  | 
 | 75 | +        Download PDF impact report.  | 
 | 76 | +        Download a Scaleway impact PDF report with detailed impact data for your Scaleway projects.  | 
 | 77 | +        :param organization_id: The UUID of the Organization for which you want to download a report.  | 
 | 78 | +        :param date: The start date of the period for which you want to download a report (ISO 8601 format, e.g., 2025-05-01T00:00:00Z).  | 
 | 79 | +        :param type_: Type of report to download (e.g., monthly). Defaults to monthly.  | 
 | 80 | +        :return: :class:`ScwFile <ScwFile>`  | 
 | 81 | +
  | 
 | 82 | +        Usage:  | 
 | 83 | +        ::  | 
 | 84 | +
  | 
 | 85 | +            result = await api.download_impact_report()  | 
 | 86 | +        """  | 
 | 87 | + | 
 | 88 | +        res = self._request(  | 
 | 89 | +            "POST",  | 
 | 90 | +            "/environmental-footprint/v1alpha1/reports/download",  | 
 | 91 | +            body=marshal_UserApiDownloadImpactReportRequest(  | 
 | 92 | +                UserApiDownloadImpactReportRequest(  | 
 | 93 | +                    organization_id=organization_id,  | 
 | 94 | +                    date=date,  | 
 | 95 | +                    type_=type_,  | 
 | 96 | +                ),  | 
 | 97 | +                self.client,  | 
 | 98 | +            ),  | 
 | 99 | +        )  | 
 | 100 | + | 
 | 101 | +        self._throw_on_error(res)  | 
 | 102 | +        return unmarshal_ScwFile(res.json())  | 
 | 103 | + | 
 | 104 | +    async def get_impact_data(  | 
 | 105 | +        self,  | 
 | 106 | +        *,  | 
 | 107 | +        organization_id: Optional[str] = None,  | 
 | 108 | +        start_date: Optional[datetime] = None,  | 
 | 109 | +        end_date: Optional[datetime] = None,  | 
 | 110 | +        regions: Optional[list[str]] = None,  | 
 | 111 | +        zones: Optional[list[str]] = None,  | 
 | 112 | +        project_ids: Optional[list[str]] = None,  | 
 | 113 | +        service_categories: Optional[list[ServiceCategory]] = None,  | 
 | 114 | +        product_categories: Optional[list[ProductCategory]] = None,  | 
 | 115 | +    ) -> ImpactDataResponse:  | 
 | 116 | +        """  | 
 | 117 | +        Retrieve detailed impact data.  | 
 | 118 | +        Retrieve detailed impact data for your Scaleway projects within a specified date range. Filter by project ID, region, zone, service category, and/or product category.  | 
 | 119 | +        :param organization_id: The UUID of the Organization for which you want to download a report.  | 
 | 120 | +        :param start_date: Start date (inclusive) of the period for which you want to retrieve impact data (ISO 8601 format, e.g., 2025-05-01T00:00:00Z).  | 
 | 121 | +        :param end_date: End date (exclusive) of the period for which you want to retrieve impact data (ISO 8601 format, with time in UTC, `YYYY-MM-DDTHH:MM:SSZ`). Defaults to today's date.  | 
 | 122 | +        :param regions: List of regions to filter by (\"fr-par\"). Defaults to all regions.  | 
 | 123 | +        :param zones: List of zones to filter by (\"fr-par-1\"). Defaults to all zones.  | 
 | 124 | +        :param project_ids: List of Project IDs to filter by. Defaults to all Projects in the Organization.  | 
 | 125 | +        :param service_categories: List of service categories to filter by. Defaults to all service categories.  | 
 | 126 | +        :param product_categories: List of product categories to filter by. Defaults to all product categories.  | 
 | 127 | +        :return: :class:`ImpactDataResponse <ImpactDataResponse>`  | 
 | 128 | +
  | 
 | 129 | +        Usage:  | 
 | 130 | +        ::  | 
 | 131 | +
  | 
 | 132 | +            result = await api.get_impact_data()  | 
 | 133 | +        """  | 
 | 134 | + | 
 | 135 | +        res = self._request(  | 
 | 136 | +            "GET",  | 
 | 137 | +            "/environmental-footprint/v1alpha1/data/query",  | 
 | 138 | +            params={  | 
 | 139 | +                "end_date": end_date,  | 
 | 140 | +                "organization_id": organization_id  | 
 | 141 | +                or self.client.default_organization_id,  | 
 | 142 | +                "product_categories": product_categories,  | 
 | 143 | +                "project_ids": project_ids,  | 
 | 144 | +                "regions": regions,  | 
 | 145 | +                "service_categories": service_categories,  | 
 | 146 | +                "start_date": start_date,  | 
 | 147 | +                "zones": zones,  | 
 | 148 | +            },  | 
 | 149 | +        )  | 
 | 150 | + | 
 | 151 | +        self._throw_on_error(res)  | 
 | 152 | +        return unmarshal_ImpactDataResponse(res.json())  | 
0 commit comments