From b007b335eb243549d7f24c37aa86739db44566d9 Mon Sep 17 00:00:00 2001 From: Sonia <31467983+bsoniam@users.noreply.github.com> Date: Wed, 24 Apr 2019 14:45:43 +0200 Subject: [PATCH] Add send new enrolment code API --- users.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/users.go b/users.go index 33d81a1..af673bb 100644 --- a/users.go +++ b/users.go @@ -9,14 +9,16 @@ import ( const ( userPath = "/auth/admin/realms/:realm/users" - usersAdminExtensionApiPath = "/auth/realms/:realmReq/api/admin/realms/:realm/users" + usersAdminExtensionApiPath = "/auth/realms/:realmReq/api/admin/realms/:realm/users" userCountPath = userPath + "/count" userIDPath = userPath + "/:id" userGroupsPath = userIDPath + "/groups" resetPasswordPath = userIDPath + "/reset-password" sendVerifyEmailPath = userIDPath + "/send-verify-email" executeActionsEmailPath = userIDPath + "/execute-actions-email" - getCredentialsForUserPath = usersAdminExtensionApiPath +"/:id/credentials" + smsAPI = "/auth/realms/:realm/smsApi" + sendNewEnrolmentCode = smsAPI + "/sendNewCode" + getCredentialsForUserPath = usersAdminExtensionApiPath + "/:id/credentials" deleteCredentialsForUserPath = getCredentialsForUserPath + "/:credid" ) @@ -98,6 +100,17 @@ func (c *Client) ExecuteActionsEmail(accessToken string, realmName string, userI return c.put(accessToken, plugins...) } +// Send a new enrolment code +func (c *Client) SendNewEnrolmentCode(accessToken string, realmName string, userID string) error { + + var paramKV []string + paramKV = append(paramKV, "userid", userID) + var plugins = append(createQueryPlugins(paramKV...), url.Path(sendNewEnrolmentCode), url.Param("realm", realmName)) + + _, err := c.post(accessToken, nil, plugins...) + return err +} + // GetCredentialsForUser gets the credential list for a user func (c *Client) GetCredentialsForUser(accessToken string, realmReq, realmName string, userID string) ([]CredentialRepresentation, error) { var resp = []CredentialRepresentation{}