feat: add delete tenant command

This commit is contained in:
2024-02-27 15:30:21 +01:00
parent df1a586d38
commit 8438c4bc1a
5 changed files with 88 additions and 5 deletions

View File

@ -0,0 +1,26 @@
package client
import (
"context"
"fmt"
"github.com/pkg/errors"
)
func (c *Client) DeleteTenant(ctx context.Context, tenantID TenantID, funcs ...OptionFunc) (TenantID, error) {
response := withResponse[struct {
TenantID string `json:"tenantId"`
}]()
path := fmt.Sprintf("/api/v1/tenants/%s", tenantID)
if err := c.apiDelete(ctx, path, nil, &response, funcs...); err != nil {
return "", errors.WithStack(err)
}
if response.Error != nil {
return "", errors.WithStack(response.Error)
}
return TenantID(response.Data.TenantID), nil
}