// UpdatePhoneNumber makes changes to your number
// It returns error object
178462
func (api *Client) UpdatePhoneNumber(idOrNumber string, data *UpdatePhoneNumberData) error {
	_, _, err := api.makeRequest(http.MethodPost, fmt.Sprintf("%s/%s", api.concatUserPath(phoneNumbersPath), url.QueryEscape(idOrNumber)), nil, data)
	return err
}
928033
func (i *Issue) GetNumber() int {
	if i == nil || i.Number == nil {
		return 0
	}
	return *i.Number
}
531222
func (api *Client) GetPhoneNumber(idOrNumber string) (*PhoneNumber, error) {
	result, _, err := api.makeRequest(http.MethodGet, fmt.Sprintf("%s/%s", api.concatUserPath(phoneNumbersPath), url.QueryEscape(idOrNumber)), &PhoneNumber{})
	if err != nil {
		return nil, err
	}
	return result.(*PhoneNumber), nil
}
1075194
func (s *ListPhoneNumberOrdersOutput) SetPhoneNumberOrders(v []*PhoneNumberOrder) *ListPhoneNumberOrdersOutput {
	s.PhoneNumberOrders = v
	return s
}
1349911
func (mr *MockExtractMockRecorder) Update(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockExtract)(nil).Update), arg0)
}
108238
func (mr *MockUserMockRecorder) Update(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockUser)(nil).Update), arg0)
}
234664
func (s *RestorePhoneNumberInput) SetPhoneNumberId(v string) *RestorePhoneNumberInput {
	s.PhoneNumberId = &v
	return s
}
226231
func (L *State) PushNumber(n float64) {
	C.lua_pushnumber(L.s, C.lua_Number(n))
}
1328716
func (service *Service) PhonenumberRegistrationValidation(w http.ResponseWriter, r *http.Request) {
	service.handlePhoneValidation(w, r, true)
}
369988
func (s *PhoneNumber) SetPhoneNumberId(v string) *PhoneNumber {
	s.PhoneNumberId = &v
	return s
}
1062359
func (s *ListPhoneNumbersOptedOutOutput) SetPhoneNumbers(v []*string) *ListPhoneNumbersOptedOutOutput {
	s.PhoneNumbers = v
	return s
}
638956
func (s *AssociatePhoneNumberWithUserInput) SetE164PhoneNumber(v string) *AssociatePhoneNumberWithUserInput {
	s.E164PhoneNumber = &v
	return s
}
1078530
func (s *AnnotationValue) SetNumberValue(v float64) *AnnotationValue {
	s.NumberValue = &v
	return s
}
131627
func (service *Service) ProcessPhonenumberConfirmationForm(w http.ResponseWriter, r *http.Request) {
	values := struct {
		Smscode string `json:"smscode"`
	}{}

	response := struct {
		Error     string `json:"error"`
		Confirmed bool   `json:"confirmed"`
	}{}

	if err := json.NewDecoder(r.Body).Decode(&values); err != nil {
		log.Debug("Error decoding the ProcessPhonenumberConfirmation request:", err)
		http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
		return
	}

	if values.Smscode == "" {
		log.Debug("Tried to confirm phone number with empty sms code")
		http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
		return
	}

	registrationSession, err := service.GetSession(r, SessionForRegistration, "registrationdetails")
	if err != nil {
		log.Debug("Failed to get registration session: ", err)
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}
	if registrationSession.IsNew {
		sessions.Save(r, w)
		log.Debug("Registration session expired")
		http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
		return
	}

	sessionKey, _ := registrationSession.Values["sessionkey"].(string)
	if sessionKey == "" {
		log.Debug("Trying to confirm phone number without session key")
		sessions.Save(r, w)
		http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
		return
	}

	registeringUser, err := registration.NewManager(r).GetRegisteringUserBySessionKey(sessionKey)
	if err != nil {
		log.Error("Failed to load registering user object: ", err)
		sessions.Save(r, w)
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}

	logMgr := persistentlog.NewManager(r)
	if isConfirmed, _ := service.phonenumberValidationService.IsConfirmed(r, registeringUser.PhoneValidationKey); isConfirmed {
		logMgr.SaveLog(persistentlog.New(sessionKey, persistentlog.RegistrationFlow, "User processed phone number form, but phone is already confirmed"))
		response.Confirmed = true
		w.WriteHeader(http.StatusOK)
		json.NewEncoder(w).Encode(response)
		return
	}

	err = service.phonenumberValidationService.ConfirmRegistrationValidation(r, registeringUser.PhoneValidationKey, values.Smscode)
	if err == validation.ErrInvalidCode {
		logMgr.SaveLog(persistentlog.New(sessionKey, persistentlog.RegistrationFlow, "User processed phone number form with invalid code"))
		w.WriteHeader(http.StatusUnprocessableEntity)
		response.Error = "invalid_sms_code"
		json.NewEncoder(w).Encode(&response)
		return
	}
	if err == validation.ErrInvalidOrExpiredKey {
		logMgr.SaveLog(persistentlog.New(sessionKey, persistentlog.RegistrationFlow, "User processed phone number form, but key is expired"))
		sessions.Save(r, w)
		http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized)
		json.NewEncoder(w).Encode(&response)
		return
	} else if err != nil {
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}
	logMgr.SaveLog(persistentlog.New(sessionKey, persistentlog.RegistrationFlow, "User processed phone number form successfully, phone is confirmed"))
	response.Confirmed = true
	w.WriteHeader(http.StatusOK)
	json.NewEncoder(w).Encode(response)
}
168831
func (s *NumberValidateRequest) SetPhoneNumber(v string) *NumberValidateRequest {
	s.PhoneNumber = &v
	return s
}
625764
func (s *CodeGenNode) SetLineNumber(v int64) *CodeGenNode {
	s.LineNumber = &v
	return s
}
1067898
func (s *PSTNDialIn) SetPhoneNumber(v string) *PSTNDialIn {
	s.PhoneNumber = &v
	return s
}