When sending without a file the following error is encountered:
$ go run fax_send.go -to=+16505550100
panic: Status: 400 Bad Request, Body: {
"message" : "Bad Request",
"errors" : [ ]
}
This is handled by MessagesApi.SendFaxMessage:
https://github.com/grokify/go-ringcentral/blob/master/client/messages_api.go#L530
func (a *MessagesApiService) SendFaxMessage(ctx context.Context, accountId string, extensionId string, localVarFile *os.File, faxResolution string, to []string, localVarOptionals map[string]interface{}) (FaxResponse, *http.Response, error) {
It sets up the following vars.
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload FaxResponse
)
localVarFileName and localVarFileBytes are not populated when localVarFile is nil, however it is still sent to prepareRequest:
https://github.com/grokify/go-ringcentral/blob/master/client/messages_api.go#L600
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
Need to investigate what happens in client.prepareRequest with empty localVarFileName and localVarFileBytes.
When sending without a file the following error is encountered:
This is handled by
MessagesApi.SendFaxMessage:https://github.com/grokify/go-ringcentral/blob/master/client/messages_api.go#L530
func (a *MessagesApiService) SendFaxMessage(ctx context.Context, accountId string, extensionId string, localVarFile *os.File, faxResolution string, to []string, localVarOptionals map[string]interface{}) (FaxResponse, *http.Response, error) {It sets up the following vars.
localVarFileNameandlocalVarFileBytesare not populated whenlocalVarFileis nil, however it is still sent toprepareRequest:https://github.com/grokify/go-ringcentral/blob/master/client/messages_api.go#L600
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)Need to investigate what happens in
client.prepareRequestwith emptylocalVarFileNameandlocalVarFileBytes.