diff --git a/definitions.go b/definitions.go index 7c34bb3..aff77e4 100644 --- a/definitions.go +++ b/definitions.go @@ -661,3 +661,7 @@ type UserSessionRepresentation struct { UserId *string `json:"userId,omitempty"` Username *string `json:"username,omitempty"` } + +type SmsCodeRepresentation struct { + Code *string `json:"code,omitempty"` +} \ No newline at end of file diff --git a/users.go b/users.go index 3ffb753..9116c6b 100644 --- a/users.go +++ b/users.go @@ -102,13 +102,15 @@ func (c *Client) ExecuteActionsEmail(accessToken string, realmName string, userI } // Send a new enrolment code and return it -func (c *Client) SendNewEnrolmentCode(accessToken string, realmName string, userID string) (string, error) { - +func (c *Client) SendNewEnrolmentCode(accessToken string, realmName string, userID string) (SmsCodeRepresentation, error) { var paramKV []string paramKV = append(paramKV, "userid", userID) var plugins = append(createQueryPlugins(paramKV...), url.Path(sendNewEnrolmentCode), url.Param("realm", realmName)) + var resp = SmsCodeRepresentation{} + + _, err := c.post(accessToken, &resp, plugins...) - return c.post(accessToken, nil, plugins...) + return resp, err } // GetCredentialsForUser gets the credential list for a user