Skip to content

Latest commit

 

History

History
979 lines (755 loc) · 49.4 KB

File metadata and controls

979 lines (755 loc) · 49.4 KB

FormanceOrchestrationV1

(Orchestration.V1)

Overview

Available Operations

CancelEvent

Cancel a running workflow

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.CancelEvent(ctx, operations.CancelEventRequest{
        InstanceID: "xxx",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.CancelEventRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.CancelEventResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

CreateTrigger

Create trigger

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.CreateTrigger(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.CreateTriggerResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request shared.TriggerData ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.CreateTriggerResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

CreateWorkflow

Create a workflow

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.CreateWorkflow(ctx, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.CreateWorkflowResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request shared.CreateWorkflowRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.CreateWorkflowResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

DeleteTrigger

Read trigger

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.DeleteTrigger(ctx, operations.DeleteTriggerRequest{
        TriggerID: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.DeleteTriggerRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.DeleteTriggerResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

DeleteWorkflow

Delete a flow by id

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.DeleteWorkflow(ctx, operations.DeleteWorkflowRequest{
        FlowID: "xxx",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.DeleteWorkflowRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.DeleteWorkflowResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

GetInstance

Get a workflow instance by id

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.GetInstance(ctx, operations.GetInstanceRequest{
        InstanceID: "xxx",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.GetWorkflowInstanceResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.GetInstanceRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetInstanceResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

GetInstanceHistory

Get a workflow instance history by id

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.GetInstanceHistory(ctx, operations.GetInstanceHistoryRequest{
        InstanceID: "xxx",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.GetWorkflowInstanceHistoryResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.GetInstanceHistoryRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetInstanceHistoryResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

GetInstanceStageHistory

Get a workflow instance stage history

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.GetInstanceStageHistory(ctx, operations.GetInstanceStageHistoryRequest{
        InstanceID: "xxx",
        Number: 0,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.GetWorkflowInstanceHistoryStageResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.GetInstanceStageHistoryRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetInstanceStageHistoryResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

GetWorkflow

Get a flow by id

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.GetWorkflow(ctx, operations.GetWorkflowRequest{
        FlowID: "xxx",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.GetWorkflowResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.GetWorkflowRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.GetWorkflowResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

ListInstances

List instances of a workflow

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.ListInstances(ctx, operations.ListInstancesRequest{
        Running: formancesdkgo.Bool(true),
        WorkflowID: formancesdkgo.String("xxx"),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ListRunsResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.ListInstancesRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.ListInstancesResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

ListTriggers

List triggers

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.ListTriggers(ctx, operations.ListTriggersRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.ListTriggersResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.ListTriggersRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.ListTriggersResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

ListTriggersOccurrences

List triggers occurrences

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.ListTriggersOccurrences(ctx, operations.ListTriggersOccurrencesRequest{
        TriggerID: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ListTriggersOccurrencesResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.ListTriggersOccurrencesRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.ListTriggersOccurrencesResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

ListWorkflows

List registered workflows

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.ListWorkflows(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.ListWorkflowsResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.ListWorkflowsResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

OrchestrationgetServerInfo

Get server info

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.OrchestrationgetServerInfo(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.ServerInfo != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
opts []operations.Option The options for this request.

Response

*operations.OrchestrationgetServerInfoResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

ReadTrigger

Read trigger

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.ReadTrigger(ctx, operations.ReadTriggerRequest{
        TriggerID: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ReadTriggerResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.ReadTriggerRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.ReadTriggerResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

RunWorkflow

Run workflow

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.RunWorkflow(ctx, operations.RunWorkflowRequest{
        WorkflowID: "xxx",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.RunWorkflowResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.RunWorkflowRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.RunWorkflowResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*

SendEvent

Send an event to a running workflow

Example Usage

package main

import(
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/shared"
	formancesdkgo "github.com/formancehq/formance-sdk-go/v3"
	"context"
	"github.com/formancehq/formance-sdk-go/v3/pkg/models/operations"
	"log"
)

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            ClientID: formancesdkgo.String("<YOUR_CLIENT_ID_HERE>"),
            ClientSecret: formancesdkgo.String("<YOUR_CLIENT_SECRET_HERE>"),
        }),
    )

    ctx := context.Background()
    res, err := s.Orchestration.V1.SendEvent(ctx, operations.SendEventRequest{
        InstanceID: "xxx",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.SendEventRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.SendEventResponse, error

Errors

Error Type Status Code Content Type
sdkerrors.Error default application/json
sdkerrors.SDKError 4XX, 5XX */*