summaryrefslogtreecommitdiffstats
path: root/internal/client/email.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/client/email.go')
-rw-r--r--internal/client/email.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/client/email.go b/internal/client/email.go
new file mode 100644
index 0000000..a7000fe
--- /dev/null
+++ b/internal/client/email.go
@@ -0,0 +1,28 @@
+package client
+
+import (
+ "encoding/json"
+ "fmt"
+ "git.db.org.ai/dborg/internal/models"
+ "strings"
+)
+
+func (c *Client) VerifyEmail(email string) (*models.EmailVerifyResponse, error) {
+ email = strings.TrimSpace(email)
+ if email == "" {
+ return nil, fmt.Errorf("email address cannot be empty")
+ }
+
+ path := fmt.Sprintf("/email/verify/%s", email)
+ data, err := c.Get(path, nil)
+ if err != nil {
+ return nil, err
+ }
+
+ var response models.EmailVerifyResponse
+ if err := json.Unmarshal(data, &response); err != nil {
+ return nil, fmt.Errorf("failed to parse email verification response: %w", err)
+ }
+
+ return &response, nil
+}