From a2084315ea0029a635b931ce9ec6ebb3d544f3c3 Mon Sep 17 00:00:00 2001 From: harture Date: Thu, 18 Apr 2019 11:40:57 +0200 Subject: [PATCH] Add execute actions email --- users.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/users.go b/users.go index 3e68638..d90b1dc 100644 --- a/users.go +++ b/users.go @@ -13,6 +13,7 @@ const ( userIDPath = userPath + "/:id" resetPasswordPath = userIDPath + "/reset-password" sendVerifyEmailPath = userIDPath + "/send-verify-email" + executeActionsEmailPath = userIDPath + "/execute-actions-email" getCredentialsForUserPath = "/auth/realms/:realmReq/api/admin/realms/:realm/users/:id/credentials" deleteCredentialsForUserPath = getCredentialsForUserPath + "/:credid" ) @@ -77,6 +78,17 @@ func (c *Client) SendVerifyEmail(accessToken string, realmName string, userID st return c.put(accessToken, plugins...) } +// ExecuteActionsEmail sends an update account email to the user. An email contains a link the user can click to perform a set of required actions. +func (c *Client) ExecuteActionsEmail(accessToken string, realmName string, userID string, actions []string, paramKV ...string) error { + if len(paramKV)%2 != 0 { + return fmt.Errorf("the number of key/val parameters should be even") + } + + var plugins = append(createQueryPlugins(paramKV...), url.Path(executeActionsEmailPath), url.Param("realm", realmName), url.Param("id", userID), body.JSON(actions)) + + return c.put(accessToken, plugins...) +} + // GetCredentialsForUser gets the credential list for a user func (c *Client) GetCredentialsForUser(accessToken string, realmReq, realmName string, userID string) ([]CredentialRepresentation, error) { var resp = []CredentialRepresentation{}