Skip to content

Latest commit

 

History

History
978 lines (672 loc) · 42.6 KB

README.md

File metadata and controls

978 lines (672 loc) · 42.6 KB

SDKV2

Overview

Available Operations

cancelEvent

Cancel a running workflow

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2CancelEventRequest(
        instanceID: 'xxx',
    );
    $response = $sdk->orchestrationV2->cancelEvent($request);

    if ($response->statusCode === 200) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2CancelEventRequest ✔️ The request object to use for the request.

Response

?Operations\V2CancelEventResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

createTrigger

Create trigger

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Shared\V2TriggerData(
        event: '<value>',
        workflowID: '<value>',
    );
    $response = $sdk->orchestrationV2->createTrigger($request);

    if ($response->v2CreateTriggerResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Shared\V2TriggerData ✔️ The request object to use for the request.

Response

?Operations\V2CreateTriggerResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

createWorkflow

Create a workflow

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Shared\V2CreateWorkflowRequest(
        stages: [
            [
                'key' => '<value>',
            ],
        ],
    );
    $response = $sdk->orchestrationV2->createWorkflow($request);

    if ($response->v2CreateWorkflowResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Shared\V2CreateWorkflowRequest ✔️ The request object to use for the request.

Response

?Operations\V2CreateWorkflowResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

deleteTrigger

Read trigger

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2DeleteTriggerRequest(
        triggerID: '<value>',
    );
    $response = $sdk->orchestrationV2->deleteTrigger($request);

    if ($response->statusCode === 200) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2DeleteTriggerRequest ✔️ The request object to use for the request.

Response

?Operations\V2DeleteTriggerResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

deleteWorkflow

Delete a flow by id

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2DeleteWorkflowRequest(
        flowId: 'xxx',
    );
    $response = $sdk->orchestrationV2->deleteWorkflow($request);

    if ($response->statusCode === 200) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2DeleteWorkflowRequest ✔️ The request object to use for the request.

Response

?Operations\V2DeleteWorkflowResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

getInstance

Get a workflow instance by id

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2GetInstanceRequest(
        instanceID: 'xxx',
    );
    $response = $sdk->orchestrationV2->getInstance($request);

    if ($response->v2GetWorkflowInstanceResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2GetInstanceRequest ✔️ The request object to use for the request.

Response

?Operations\V2GetInstanceResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

getInstanceHistory

Get a workflow instance history by id

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2GetInstanceHistoryRequest(
        instanceID: 'xxx',
    );
    $response = $sdk->orchestrationV2->getInstanceHistory($request);

    if ($response->v2GetWorkflowInstanceHistoryResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2GetInstanceHistoryRequest ✔️ The request object to use for the request.

Response

?Operations\V2GetInstanceHistoryResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

getInstanceStageHistory

Get a workflow instance stage history

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2GetInstanceStageHistoryRequest(
        instanceID: 'xxx',
        number: 0,
    );
    $response = $sdk->orchestrationV2->getInstanceStageHistory($request);

    if ($response->v2GetWorkflowInstanceHistoryStageResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2GetInstanceStageHistoryRequest ✔️ The request object to use for the request.

Response

?Operations\V2GetInstanceStageHistoryResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

getServerInfo

Get server info

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $response = $sdk->orchestrationV2->getServerInfo();

    if ($response->v2ServerInfo !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Response

?Operations\V2GetServerInfoResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

getWorkflow

Get a flow by id

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2GetWorkflowRequest(
        flowId: 'xxx',
    );
    $response = $sdk->orchestrationV2->getWorkflow($request);

    if ($response->v2GetWorkflowResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2GetWorkflowRequest ✔️ The request object to use for the request.

Response

?Operations\V2GetWorkflowResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

listInstances

List instances of a workflow

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2ListInstancesRequest(
        cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
        pageSize: 100,
        running: true,
        workflowID: 'xxx',
    );
    $response = $sdk->orchestrationV2->listInstances($request);

    if ($response->v2ListRunsResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2ListInstancesRequest ✔️ The request object to use for the request.

Response

?Operations\V2ListInstancesResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

listTriggers

List triggers

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2ListTriggersRequest(
        cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
        pageSize: 100,
    );
    $response = $sdk->orchestrationV2->listTriggers($request);

    if ($response->v2ListTriggersResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2ListTriggersRequest ✔️ The request object to use for the request.

Response

?Operations\V2ListTriggersResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

listTriggersOccurrences

List triggers occurrences

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2ListTriggersOccurrencesRequest(
        triggerID: '<value>',
        cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
        pageSize: 100,
    );
    $response = $sdk->orchestrationV2->listTriggersOccurrences($request);

    if ($response->v2ListTriggersOccurrencesResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2ListTriggersOccurrencesRequest ✔️ The request object to use for the request.

Response

?Operations\V2ListTriggersOccurrencesResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

listWorkflows

List registered workflows

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2ListWorkflowsRequest(
        cursor: 'aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==',
        pageSize: 100,
    );
    $response = $sdk->orchestrationV2->listWorkflows($request);

    if ($response->v2ListWorkflowsResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2ListWorkflowsRequest ✔️ The request object to use for the request.

Response

?Operations\V2ListWorkflowsResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

readTrigger

Read trigger

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2ReadTriggerRequest(
        triggerID: '<value>',
    );
    $response = $sdk->orchestrationV2->readTrigger($request);

    if ($response->v2ReadTriggerResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2ReadTriggerRequest ✔️ The request object to use for the request.

Response

?Operations\V2ReadTriggerResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

runWorkflow

Run workflow

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2RunWorkflowRequest(
        workflowID: 'xxx',
    );
    $response = $sdk->orchestrationV2->runWorkflow($request);

    if ($response->v2RunWorkflowResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2RunWorkflowRequest ✔️ The request object to use for the request.

Response

?Operations\V2RunWorkflowResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

sendEvent

Send an event to a running workflow

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\V2SendEventRequest(
        instanceID: 'xxx',
    );
    $response = $sdk->orchestrationV2->sendEvent($request);

    if ($response->statusCode === 200) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\V2SendEventRequest ✔️ The request object to use for the request.

Response

?Operations\V2SendEventResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /

testTrigger

Test trigger

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use formance\stack;
use formance\stack\Models\Operations;
use formance\stack\Models\Shared;

$security = new Shared\Security(
    authorization: "<YOUR_AUTHORIZATION_HERE>",
);

$sdk = stack\SDK::builder()->setSecurity($security)->build();

try {
    $request = new Operations\TestTriggerRequest(
        triggerID: '<value>',
    );
    $response = $sdk->orchestrationV2->testTrigger($request);

    if ($response->v2TestTriggerResponse !== null) {
        // handle response
    }
} catch (Throwable $e) {
    // handle exception
}

Parameters

Parameter Type Required Description
$request Operations\TestTriggerRequest ✔️ The request object to use for the request.

Response

?Operations\TestTriggerResponse

Errors

Error Object Status Code Content Type
Errors\V2Error default application/json
formance\stack\Models\Errors.SDKException 4xx-5xx /