Skip to content

Latest commit

 

History

History
474 lines (364 loc) · 19.9 KB

README.md

File metadata and controls

474 lines (364 loc) · 19.9 KB

Auth

(Auth)

Available Operations

CreateClient

Create client

Example Usage

package main

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

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            Authorization: "<YOUR_AUTHORIZATION_HERE>",
        }),
    )

    ctx := context.Background()
    res, err := s.Auth.CreateClient(ctx, &shared.CreateClientRequest{
        Name: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.CreateClientResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request shared.CreateClientRequest ✔️ The request object to use for the request.

Response

*operations.CreateClientResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

CreateSecret

Add a secret to a client

Example Usage

package main

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

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            Authorization: "<YOUR_AUTHORIZATION_HERE>",
        }),
    )

    ctx := context.Background()
    res, err := s.Auth.CreateSecret(ctx, operations.CreateSecretRequest{
        ClientID: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.CreateSecretResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.CreateSecretRequest ✔️ The request object to use for the request.

Response

*operations.CreateSecretResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

DeleteClient

Delete client

Example Usage

package main

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

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            Authorization: "<YOUR_AUTHORIZATION_HERE>",
        }),
    )

    ctx := context.Background()
    res, err := s.Auth.DeleteClient(ctx, operations.DeleteClientRequest{
        ClientID: "<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.DeleteClientRequest ✔️ The request object to use for the request.

Response

*operations.DeleteClientResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

DeleteSecret

Delete a secret from a client

Example Usage

package main

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

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            Authorization: "<YOUR_AUTHORIZATION_HERE>",
        }),
    )

    ctx := context.Background()
    res, err := s.Auth.DeleteSecret(ctx, operations.DeleteSecretRequest{
        ClientID: "<value>",
        SecretID: "<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.DeleteSecretRequest ✔️ The request object to use for the request.

Response

*operations.DeleteSecretResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

ListClients

List clients

Example Usage

package main

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

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            Authorization: "<YOUR_AUTHORIZATION_HERE>",
        }),
    )

    ctx := context.Background()
    res, err := s.Auth.ListClients(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.ListClientsResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.

Response

*operations.ListClientsResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

ListUsers

List users

Example Usage

package main

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

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            Authorization: "<YOUR_AUTHORIZATION_HERE>",
        }),
    )

    ctx := context.Background()
    res, err := s.Auth.ListUsers(ctx)
    if err != nil {
        log.Fatal(err)
    }
    if res.ListUsersResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.

Response

*operations.ListUsersResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

ReadClient

Read client

Example Usage

package main

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

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            Authorization: "<YOUR_AUTHORIZATION_HERE>",
        }),
    )

    ctx := context.Background()
    res, err := s.Auth.ReadClient(ctx, operations.ReadClientRequest{
        ClientID: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ReadClientResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.ReadClientRequest ✔️ The request object to use for the request.

Response

*operations.ReadClientResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

ReadUser

Read user

Example Usage

package main

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

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            Authorization: "<YOUR_AUTHORIZATION_HERE>",
        }),
    )

    ctx := context.Background()
    res, err := s.Auth.ReadUser(ctx, operations.ReadUserRequest{
        UserID: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.ReadUserResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.ReadUserRequest ✔️ The request object to use for the request.

Response

*operations.ReadUserResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /

UpdateClient

Update client

Example Usage

package main

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

func main() {
    s := formancesdkgo.New(
        formancesdkgo.WithSecurity(shared.Security{
            Authorization: "<YOUR_AUTHORIZATION_HERE>",
        }),
    )

    ctx := context.Background()
    res, err := s.Auth.UpdateClient(ctx, operations.UpdateClientRequest{
        ClientID: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.UpdateClientResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.UpdateClientRequest ✔️ The request object to use for the request.

Response

*operations.UpdateClientResponse, error

Error Object Status Code Content Type
sdkerrors.SDKError 4xx-5xx /