combocurve-client-csharp

Logo

C# client for the ComboCurve REST API

View the Project on GitHub insidepetroleum/combocurve-client-csharp

ComboCurve.Api.Api.ForecastRunApi

All URIs are relative to https://api.combocurve.com

Method HTTP request Description
GetForecastRunStatus GET /v1/projects/{projectId}/forecasts/{forecastId}/run/{jobId} Returns the current status of a forecast run. The `jobId` must belong to the forecast identified by `forecastId` in the URL — callers cannot use this endpoint to poll arbitrary task IDs.
PostForecastRun POST /v1/projects/{projectId}/forecasts/{forecastId}/run Starts an asynchronous forecast run for the specified forecast. Always returns `202 Accepted` immediately with a `jobId` that can be polled via `GET …/run/{jobId}`. The server resolves the orchestrator (`autoFullForecast` or `customStreamsForecast`) automatically from the forecast's `type` field — callers do not choose. Mode A (defaults): Send an empty body `{}`. The server uses ComboCurve's built-in defaults for the forecast type. Mode B (saved configuration): Send `{ \"configurationId\": \"…\" }`. The server loads the saved forecast configuration, validates that its `forecastType` matches the target forecast's `type`, and runs it verbatim. Company-enforced forecast settings are applied server-side in both modes, matching the behaviour of the client UI.

GetForecastRunStatus

ForecastRunStatus GetForecastRunStatus (string projectId, string forecastId, string jobId)

Returns the current status of a forecast run. The jobId must belong to the forecast identified by forecastId in the URL — callers cannot use this endpoint to poll arbitrary task IDs.

Example

using System;
using System.Collections.Generic;
using System.Diagnostics;
using ComboCurve.Api.Api;
using ComboCurve.Api.Auth;
using ComboCurve.Api.Client;
using ComboCurve.Api.Model;

namespace Example
{
    public class GetForecastRunStatusExample
    {
        public static void Main()
        {
            // Use this to create your service account manually
            var serviceAccount = new ServiceAccount
            {
                ClientEmail = "YOUR_CLIENT_EMAIL",
                ClientId = "YOUR_CLIENT_ID",
                PrivateKey = "YOUR_PRIVATE_KEY"
            };

            // Or use this to load it from a JSON file
            // var serviceAccount = ServiceAccount.FromFile("PATH_TO_JSON_FILE");

            // Set your API key
            var apiKey = "YOUR_API_KEY";

            var apiInstance = new ComboCurveV1Api(serviceAccount, apiKey);

			// Or use the specific API class (Recommended)
			// var apiInstance = new ForecastRunApi(serviceAccount, apiKey);

            var projectId = "projectId_example";  // string | The ID of the project containing the forecast.
            var forecastId = "forecastId_example";  // string | The ID of the forecast that was run.
            var jobId = "jobId_example";  // string | The `jobId` returned by `POST .../run`.

            try
            {
                // Returns the current status of a forecast run. The `jobId` must belong to the forecast identified by `forecastId` in the URL — callers cannot use this endpoint to poll arbitrary task IDs.
                ForecastRunStatus result = apiInstance.GetForecastRunStatus(projectId, forecastId, jobId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ForecastRunApi.GetForecastRunStatus: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
projectId string The ID of the project containing the forecast.  
forecastId string The ID of the forecast that was run.  
jobId string The `jobId` returned by `POST …/run`.  

Return type

ForecastRunStatus

Authorization

API Key, Service Account

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| | 200 | OK | - | | 404 | Not Found. No forecast run was found with the given `jobId` scoped to the given `forecastId`. | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostForecastRun

ForecastRunJobId PostForecastRun (string projectId, string forecastId, ForecastRunRequest forecastRunConfig = null)

Starts an asynchronous forecast run for the specified forecast. Always returns 202 Accepted immediately with a jobId that can be polled via GET .../run/{jobId}. The server resolves the orchestrator (autoFullForecast or customStreamsForecast) automatically from the forecast’s type field — callers do not choose. Mode A (defaults): Send an empty body {}. The server uses ComboCurve’s built-in defaults for the forecast type. Mode B (saved configuration): Send { \"configurationId\": \"...\" }. The server loads the saved forecast configuration, validates that its forecastType matches the target forecast’s type, and runs it verbatim. Company-enforced forecast settings are applied server-side in both modes, matching the behaviour of the client UI.

Example

using System;
using System.Collections.Generic;
using System.Diagnostics;
using ComboCurve.Api.Api;
using ComboCurve.Api.Auth;
using ComboCurve.Api.Client;
using ComboCurve.Api.Model;

namespace Example
{
    public class PostForecastRunExample
    {
        public static void Main()
        {
            // Use this to create your service account manually
            var serviceAccount = new ServiceAccount
            {
                ClientEmail = "YOUR_CLIENT_EMAIL",
                ClientId = "YOUR_CLIENT_ID",
                PrivateKey = "YOUR_PRIVATE_KEY"
            };

            // Or use this to load it from a JSON file
            // var serviceAccount = ServiceAccount.FromFile("PATH_TO_JSON_FILE");

            // Set your API key
            var apiKey = "YOUR_API_KEY";

            var apiInstance = new ComboCurveV1Api(serviceAccount, apiKey);

			// Or use the specific API class (Recommended)
			// var apiInstance = new ForecastRunApi(serviceAccount, apiKey);

            var projectId = "projectId_example";  // string | The ID of the project containing the forecast.
            var forecastId = "forecastId_example";  // string | The ID of the forecast to run.
            var forecastRunConfig = new ForecastRunRequest(); // ForecastRunRequest |  (optional) 

            try
            {
                // Starts an asynchronous forecast run for the specified forecast. Always returns `202 Accepted` immediately with a `jobId` that can be polled via `GET .../run/{jobId}`. The server resolves the orchestrator (`autoFullForecast` or `customStreamsForecast`) automatically from the forecast's `type` field — callers do not choose. **Mode A (defaults):** Send an empty body `{}`. The server uses ComboCurve's built-in defaults for the forecast type. **Mode B (saved configuration):** Send `{ \"configurationId\": \"...\" }`. The server loads the saved forecast configuration, validates that its `forecastType` matches the target forecast's `type`, and runs it verbatim. Company-enforced forecast settings are applied server-side in both modes, matching the behaviour of the client UI.
                ForecastRunJobId result = apiInstance.PostForecastRun(projectId, forecastId, forecastRunConfig);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ForecastRunApi.PostForecastRun: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
projectId string The ID of the project containing the forecast.  
forecastId string The ID of the forecast to run.  
forecastRunConfig ForecastRunRequest   [optional]

Return type

ForecastRunJobId

Authorization

API Key, Service Account

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| | 202 | Accepted. The forecast run has been queued. Poll `GET …/run/{jobId}` for status. | - | | 400 | Bad Request. The request body failed schema validation, the `configurationId` references a configuration whose `forecastType` does not match the target forecast's type, or proximity forecasting was requested (not supported via the external API). | - | | 404 | Not Found. The project, forecast, or referenced forecast configuration was not found. | - | | 409 | Conflict. The forecast already has a run in progress (pending or running). Wait for the current run to complete before starting a new one. | - | | 429 | Too Many Requests. The tenant has too many runs in progress (pending or running). Wait for a run to complete before starting a new one. | - |

[Back to top] [Back to API list] [Back to Model list] [Back to README]