forked from huaweicloud/huaweicloud-sdk-go
/
requests.go
57 lines (44 loc) · 1.67 KB
/
requests.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package utilities
import "github.com/gophercloud/gophercloud"
type SendVerificationCodeOpts struct {
//Settings.
ReceiverType *int `json:"receiverType" required:"true"`
//Timeout duration of a verification code.
Timeout int `json:"timeout,omitempty"`
//The sender email address.
Email string `json:"email,omitempty"`
//Mobile number.
MobilePhone string `json:"mobilePhone,omitempty"`
//Country code.
CountryCode string `json:"countryCode,omitempty"`
//If no template information is found for the selected language, the template information for the default language is used.
Lang string `json:"lang,omitempty"`
//Supported scenarios
Scene string `json:"scene,omitempty"`
//Customer ID.
CustomerId string `json:"customerId,omitempty"`
}
type SendVerificationCodeOptsBuilder interface {
ToSendVerificationCodeMap() (map[string]interface{}, error)
}
func (opts SendVerificationCodeOpts) ToSendVerificationCodeMap() (map[string]interface{}, error) {
return gophercloud.BuildRequestBody(opts, "")
}
/**
* If customers enter email addresses for registration, this API is used to send a registration verification code to the email addresses to verify the registration information.
* This API can be invoked only by the partner AK/SK or token.
*/
func SendVerificationCode(client *gophercloud.ServiceClient, opts SendVerificationCodeOptsBuilder) (r SendVerificationCodeResult) {
domainID := client.ProviderClient.DomainID
if opts != nil {
body, err := opts.ToSendVerificationCodeMap()
if err != nil {
r.Err = err
return
}
_, r.Err = client.Post(getSendVerificationCodeURL(client, domainID), body, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{204},
})
}
return
}