github.com/grokify/go-ringcentral-client@v0.3.31/office/v1/util/ringout.go (about)

     1  package clientutil
     2  
     3  import (
     4  	rc "github.com/grokify/go-ringcentral-client/office/v1/client"
     5  )
     6  
     7  type RingOutRequest struct {
     8  	To         string
     9  	From       string
    10  	CallerId   string
    11  	PlayPrompt bool
    12  	CountryId  string
    13  }
    14  
    15  func (ro *RingOutRequest) Body() *rc.MakeRingOutRequest {
    16  	req := &rc.MakeRingOutRequest{
    17  		From: rc.MakeRingOutCallerInfoRequestFrom{
    18  			PhoneNumber: ro.From},
    19  		To: rc.MakeRingOutCallerInfoRequestTo{
    20  			PhoneNumber: ro.To},
    21  		PlayPrompt: ro.PlayPrompt,
    22  	}
    23  	if len(ro.CallerId) > 0 {
    24  		req.CallerId = rc.MakeRingOutCallerInfoRequestTo{
    25  			PhoneNumber: ro.CallerId}
    26  	}
    27  	if len(ro.CountryId) > 0 {
    28  		req.Country = rc.MakeRingOutCountryInfo{
    29  			Id: ro.CountryId}
    30  	}
    31  	return req
    32  }