profile_phone_number.go raw

   1  package linodego
   2  
   3  import (
   4  	"context"
   5  )
   6  
   7  // SendPhoneNumberVerificationCodeOptions fields are those accepted by SendPhoneNumberVerificationCode
   8  type SendPhoneNumberVerificationCodeOptions struct {
   9  	ISOCode     string `json:"iso_code"`
  10  	PhoneNumber string `json:"phone_number"`
  11  }
  12  
  13  // VerifyPhoneNumberOptions fields are those accepted by VerifyPhoneNumber
  14  type VerifyPhoneNumberOptions struct {
  15  	OTPCode string `json:"otp_code"`
  16  }
  17  
  18  // SendPhoneNumberVerificationCode sends a one-time verification code via SMS message to the submitted phone number.
  19  func (c *Client) SendPhoneNumberVerificationCode(ctx context.Context, opts SendPhoneNumberVerificationCodeOptions) error {
  20  	return doPOSTRequestNoResponseBody(ctx, c, "profile/phone-number", opts)
  21  }
  22  
  23  // DeletePhoneNumber deletes the verified phone number for the User making this request.
  24  func (c *Client) DeletePhoneNumber(ctx context.Context) error {
  25  	return doDELETERequest(ctx, c, "profile/phone-number")
  26  }
  27  
  28  // VerifyPhoneNumber verifies a phone number by confirming the one-time code received via SMS message after accessing the Phone Verification Code Send command.
  29  func (c *Client) VerifyPhoneNumber(ctx context.Context, opts VerifyPhoneNumberOptions) error {
  30  	return doPOSTRequestNoResponseBody(ctx, c, "profile/phone-number/verify", opts)
  31  }
  32