From 5d31305958f06efb92839c9eb3b995b2657da26f Mon Sep 17 00:00:00 2001 From: Herdanis Date: Fri, 6 Dec 2024 23:10:59 +0700 Subject: [PATCH] update: return value to struct --- client.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index abd7136a..4e999552 100644 --- a/client.go +++ b/client.go @@ -4508,16 +4508,19 @@ func (g *GoCloak) GetUsersManagementPermissions(ctx context.Context, accessToken return &result, nil } -func (g *GoCloak) CreateOrganization(ctx context.Context, token, realm string, organization Organization) (string, error) { +func (g *GoCloak) CreateOrganization(ctx context.Context, token, realm string, organization Organization) (*Organization, error) { const errMessage = "could not create organization" + var result Organization + resp, err := g.GetRequestWithBearerAuth(ctx, token). + SetResult(&result). SetBody(organization). Post(g.getAdminRealmURL(realm, "organizations")) if err := checkForError(resp, err, errMessage); err != nil { - return "", err + return nil, err } - return getID(resp), nil + return &result, nil }