(Auth)
- CreateClient - Create client
- CreateSecret - Add a secret to a client
- DeleteClient - Delete client
- DeleteSecret - Delete a secret from a client
- ListClients - List clients
- ListUsers - List users
- ReadClient - Read client
- ReadUser - Read user
- UpdateClient - Update client
Create client
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
}
}
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. |
*operations.CreateClientResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Add a secret to a client
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
}
}
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. |
*operations.CreateSecretResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Delete client
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
}
}
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. |
*operations.DeleteClientResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Delete a secret from a client
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
}
}
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. |
*operations.DeleteSecretResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
List clients
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
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
*operations.ListClientsResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
List users
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
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
*operations.ListUsersResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Read client
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
}
}
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. |
*operations.ReadClientResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Read user
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
}
}
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. |
*operations.ReadUserResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Update client
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
}
}
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. |
*operations.UpdateClientResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |