-
Notifications
You must be signed in to change notification settings - Fork 0
/
validation.go
42 lines (36 loc) · 1.69 KB
/
validation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package igcclient
import (
"net/http"
"net/url"
"strconv"
"github.com/moonwalker/igcclient/models"
"github.com/moonwalker/logger"
)
type ValidationService service
// Determines whether the mobile and prefix combination isvalid.
// If ignoreExisting is set to true [ignore existing].
func (s *ValidationService) Mobile(body models.ValidationMobileModel, ignoreExisting bool, headers map[string]string, log logger.Logger) (response models.OperationResponseOfBoolean, err error) {
ignore := strconv.FormatBool(ignoreExisting)
q := url.Values{}
q.Add("ignoreExisting", ignore)
err = s.client.apiReq(http.MethodPost, "/validate/mobile", &q, &body, &response, &headers, log)
return
}
// Determines whether the is username available and valid.
// If ignoreExisting is set to true [ignore existing].
func (s *ValidationService) Username(body models.ValidationUsernameModel, ignoreExisting bool, headers map[string]string, log logger.Logger) (response models.OperationResponseOfBoolean, err error) {
ignore := strconv.FormatBool(ignoreExisting)
q := url.Values{}
q.Add("ignoreExisting", ignore)
err = s.client.apiReq(http.MethodPost, "/validate/username", &q, &body, &response, &headers, log)
return
}
// Determines whether the mobile and prefix combination isvalid.
// If ignoreExisting is set to true [ignore existing].
func (s *ValidationService) Email(body models.ValidationEmailModel, ignoreExisting bool, headers map[string]string, log logger.Logger) (response models.OperationResponseOfBoolean, err error) {
ignore := strconv.FormatBool(ignoreExisting)
q := url.Values{}
q.Add("ignoreExisting", ignore)
err = s.client.apiReq(http.MethodPost, "/validate/email", &q, &body, &response, &headers, log)
return
}