From d00ea94da1f1cd19f0f970dc0e216c0bbed80244 Mon Sep 17 00:00:00 2001 From: Michael Riley Date: Wed, 9 Oct 2024 14:19:13 -0400 Subject: [PATCH] Fix base struct for subaccount create (#331) --- subaccount.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/subaccount.go b/subaccount.go index 0901b84..1097ad5 100644 --- a/subaccount.go +++ b/subaccount.go @@ -22,6 +22,10 @@ type subAccountsBase struct { Meta *Meta `json:"meta"` } +type subAccountBase struct { + SubAccount *SubAccount `json:"subaccount"` +} + // SubAccount represents a Vultr sub-account type SubAccount struct { ID string `json:"id"` @@ -65,11 +69,11 @@ func (s *SubAccountServiceHandler) Create(ctx context.Context, saReq *SubAccount return nil, nil, err } - sa := new(SubAccount) + sa := new(subAccountBase) resp, err := s.client.DoWithContext(ctx, req, sa) if err != nil { return nil, resp, err } - return sa, resp, nil + return sa.SubAccount, resp, nil }