combocurve-client-csharp

Logo

C# client for the ComboCurve REST API

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

ComboCurve.Api.Api.ScenarioRunApi

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

Method HTTP request Description
GetScenarioRunStatus GET /v1/projects/{projectId}/scenarios/{scenarioId}/run/{jobId} Returns the current status of an economics run. The `jobId` must belong to the scenario identified by `scenarioId` in the URL.
PostScenarioRun POST /v1/projects/{projectId}/scenarios/{scenarioId}/run Starts an asynchronous economics run for the specified scenario. Always returns `202 Accepted` immediately with a `jobId` that can be polled via `GET …/run/{jobId}`. Mode A (defaults): Send an empty body `{}` or `{ \"wellIds\": […] }`. The server uses the same UI dialog defaults for columns, report settings, and combos when the corresponding setting ids are omitted. Mode B (saved settings): Supply any subset of `econSettingId`, `econReportSettingId`, and `comboSettingId`. Omitted ids fall back to UI defaults for that slice. Selection: provide `wellIds`, or omit it to run every well in the scenario. Either way each well resolves to its base scenario-well-assignment; incrementals are not included.

GetScenarioRunStatus

ScenarioRunStatus GetScenarioRunStatus (string projectId, string scenarioId, string jobId)

Returns the current status of an economics run. The jobId must belong to the scenario identified by scenarioId in the URL.

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 GetScenarioRunStatusExample
    {
        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 ScenarioRunApi(serviceAccount, apiKey);

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

            try
            {
                // Returns the current status of an economics run. The `jobId` must belong to the scenario identified by `scenarioId` in the URL.
                ScenarioRunStatus result = apiInstance.GetScenarioRunStatus(projectId, scenarioId, jobId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ScenarioRunApi.GetScenarioRunStatus: " + 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 scenario.  
scenarioId string The ID of the scenario that was run.  
jobId string The `jobId` returned by `POST …/run`.  

Return type

ScenarioRunStatus

Authorization

API Key, Service Account

HTTP request headers

HTTP response details

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

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

PostScenarioRun

ScenarioRunJobId PostScenarioRun (string projectId, string scenarioId, ScenarioRunRequest scenarioRunConfig = null)

Starts an asynchronous economics run for the specified scenario. Always returns 202 Accepted immediately with a jobId that can be polled via GET .../run/{jobId}. Mode A (defaults): Send an empty body {} or { \"wellIds\": [...] }. The server uses the same UI dialog defaults for columns, report settings, and combos when the corresponding setting ids are omitted. Mode B (saved settings): Supply any subset of econSettingId, econReportSettingId, and comboSettingId. Omitted ids fall back to UI defaults for that slice. Selection: provide wellIds, or omit it to run every well in the scenario. Either way each well resolves to its base scenario-well-assignment; incrementals are not included.

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 PostScenarioRunExample
    {
        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 ScenarioRunApi(serviceAccount, apiKey);

            var projectId = "projectId_example";  // string | The ID of the project containing the scenario.
            var scenarioId = "scenarioId_example";  // string | The ID of the scenario to run.
            var scenarioRunConfig = new ScenarioRunRequest(); // ScenarioRunRequest |  (optional) 

            try
            {
                // Starts an asynchronous economics run for the specified scenario. Always returns `202 Accepted` immediately with a `jobId` that can be polled via `GET .../run/{jobId}`. **Mode A (defaults):** Send an empty body `{}` or `{ \"wellIds\": [...] }`. The server uses the same UI dialog defaults for columns, report settings, and combos when the corresponding setting ids are omitted. **Mode B (saved settings):** Supply any subset of `econSettingId`, `econReportSettingId`, and `comboSettingId`. Omitted ids fall back to UI defaults for that slice. Selection: provide `wellIds`, or omit it to run every well in the scenario. Either way each well resolves to its base scenario-well-assignment; incrementals are not included.
                ScenarioRunJobId result = apiInstance.PostScenarioRun(projectId, scenarioId, scenarioRunConfig);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling ScenarioRunApi.PostScenarioRun: " + 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 scenario.  
scenarioId string The ID of the scenario to run.  
scenarioRunConfig ScenarioRunRequest   [optional]

Return type

ScenarioRunJobId

Authorization

API Key, Service Account

HTTP request headers

HTTP response details

| Status code | Description | Response headers | |————-|————-|——————| | 202 | Accepted. The economics run has been queued. Poll `GET …/run/{jobId}` for status. | - | | 400 | Bad Request. Schema validation failed, group economics was detected, General Options are missing, or no combos are selected. | - | | 404 | Not Found. The project, scenario, well assignment, or referenced setting id was not found. | - | | 409 | Conflict. The scenario already has an economics run in progress. | - | | 429 | Too Many Requests. The tenant has too many economics runs in progress via the external API. | - |

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