CarbonAwareApi - factory interface

  • Parameters

    • Optionalconfiguration: Configuration
    • OptionalbasePath: string
    • Optionalaxios: AxiosInstance

    Returns {
        batchForecastDataAsync(
            emissionsForecastBatchParametersDTO?: EmissionsForecastBatchParametersDTO[],
            options?: RawAxiosRequestConfig,
        ): AxiosPromise<EmissionsForecastDTO[]>;
        getAverageCarbonIntensity(
            location: string,
            startTime: string,
            endTime: string,
            options?: RawAxiosRequestConfig,
        ): AxiosPromise<CarbonIntensityDTO>;
        getAverageCarbonIntensityBatch(
            carbonIntensityBatchParametersDTO?: CarbonIntensityBatchParametersDTO[],
            options?: RawAxiosRequestConfig,
        ): AxiosPromise<CarbonIntensityDTO[]>;
        getBestEmissionsDataForLocationsByTime(
            location: string[],
            time?: string,
            toTime?: string,
            options?: RawAxiosRequestConfig,
        ): AxiosPromise<EmissionsData[]>;
        getCurrentForecastData(
            location: string[],
            dataStartAt?: string,
            dataEndAt?: string,
            windowSize?: number,
            options?: RawAxiosRequestConfig,
        ): AxiosPromise<EmissionsForecastDTO[]>;
        getEmissionsDataForLocationByTime(
            location: string,
            time?: string,
            toTime?: string,
            options?: RawAxiosRequestConfig,
        ): AxiosPromise<EmissionsData[]>;
        getEmissionsDataForLocationsByTime(
            location: string[],
            time?: string,
            toTime?: string,
            options?: RawAxiosRequestConfig,
        ): AxiosPromise<EmissionsData[]>;
    }

    • batchForecastDataAsync:function
      • This endpoint takes a batch of requests for historical forecast data, fetches them, and calculates the optimal marginal carbon intensity windows for each using the same parameters available to the '/emissions/forecasts/current' endpoint. This endpoint is useful for back-testing what one might have done in the past, if they had access to the current forecast at the time.

        Parameters

        • OptionalemissionsForecastBatchParametersDTO: EmissionsForecastBatchParametersDTO[]

          Array of requested forecasts.

        • Optionaloptions: RawAxiosRequestConfig

          Override http request option.

        Returns AxiosPromise<EmissionsForecastDTO[]>

    • getAverageCarbonIntensity:function
      • This endpoint is useful for reporting the measured carbon intensity for a specific time period in a specific location.

        Parameters

        • location: string

          The location name where workflow is run

        • startTime: string

          The time at which the workflow we are measuring carbon intensity for started

        • endTime: string

          The time at which the workflow we are measuring carbon intensity for ended

        • Optionaloptions: RawAxiosRequestConfig

          Override http request option.

        Returns AxiosPromise<CarbonIntensityDTO>

    • getAverageCarbonIntensityBatch:function
      • The application only supports batching across a single location with different time boundaries. If multiple locations are provided, an error is returned. For each item in the request array, the application returns a corresponding object containing the location, time boundaries, and average marginal carbon intensity.

        Parameters

        • OptionalcarbonIntensityBatchParametersDTO: CarbonIntensityBatchParametersDTO[]

          Array of inputs where each contains a &quot;location&quot;, &quot;startDate&quot;, and &quot;endDate&quot; for which to calculate average marginal carbon intensity.

        • Optionaloptions: RawAxiosRequestConfig

          Override http request option.

        Returns AxiosPromise<CarbonIntensityDTO[]>

    • getBestEmissionsDataForLocationsByTime:function
      • Parameters

        • location: string[]

          String array of named locations

        • Optionaltime: string

          [Optional] Start time for the data query.

        • OptionaltoTime: string

          [Optional] End time for the data query.

        • Optionaloptions: RawAxiosRequestConfig

          Override http request option.

        Returns AxiosPromise<EmissionsData[]>

    • getCurrentForecastData:function
      • This endpoint fetches only the most recently generated forecast for all provided locations. It uses the "dataStartAt" and "dataEndAt" parameters to scope the forecasted data points (if available for those times). If no start or end time boundaries are provided, the entire forecast dataset is used. The scoped data points are used to calculate average marginal carbon intensities of the specified "windowSize" and the optimal marginal carbon intensity window is identified. The forecast data represents what the data source predicts future marginal carbon intensity values to be, not actual measured emissions data (as future values cannot be known). This endpoint is useful for determining if there is a more carbon-optimal time to use electricity predicted in the future.

        Parameters

        • location: string[]

          String array of named locations

        • OptionaldataStartAt: string

          Start time boundary of forecasted data points.Ignores current forecast data points before this time. Defaults to the earliest time in the forecast data.

        • OptionaldataEndAt: string

          End time boundary of forecasted data points. Ignores current forecast data points after this time. Defaults to the latest time in the forecast data.

        • OptionalwindowSize: number

          The estimated duration (in minutes) of the workload. Defaults to the duration of a single forecast data point.

        • Optionaloptions: RawAxiosRequestConfig

          Override http request option.

        Returns AxiosPromise<EmissionsForecastDTO[]>

    • getEmissionsDataForLocationByTime:function
      • Parameters

        • location: string

          String named location.

        • Optionaltime: string

          [Optional] Start time for the data query.

        • OptionaltoTime: string

          [Optional] End time for the data query.

        • Optionaloptions: RawAxiosRequestConfig

          Override http request option.

        Returns AxiosPromise<EmissionsData[]>

    • getEmissionsDataForLocationsByTime:function
      • Parameters

        • location: string[]

          String array of named locations

        • Optionaltime: string

          [Optional] Start time for the data query.

        • OptionaltoTime: string

          [Optional] End time for the data query.

        • Optionaloptions: RawAxiosRequestConfig

          Override http request option.

        Returns AxiosPromise<EmissionsData[]>