//DoRequestDownload execute an http request to download an item
//parameters:
//  pMethod = http request method (GET,..)
//  pUrl = request url
//  pWriter = response body writer
//returns:
//  error in case of error
DoRequestDownload execute an http request to download an item
parameters:
pMethod = http request method (GET,..)
pUrl = request url
pWriter = response body writer
returns:
error in case of error
// DoRequestDownload execute an http request to download an item // parameters : // pMethod = http request method ( GET .. ) // pUrl = request url // pWriter = response body writer // returns : // error in case of error
func (vSelf *OneDriveClient) DoRequestDownload(pMethod string, pURL string, pWriter io.Writer) (vRisError error) {
	var vURL string
	if strings.Contains(pURL, "://") {
		vURL = pURL
	} else {
		vURL = "https://api.onedrive.com/v1.0" + pURL
	}
	vRequest, vError := http.NewRequest(pMethod, vURL, nil)
	if vError != nil {
		return diagnostic.NewError("Error creating request %s", vError, pURL)
	}
	vResponse, vError := vSelf.doRequest(vRequest, 0)
	if vError != nil {
		return diagnostic.NewError("Error executing request %s", vError, pURL)
	}
	_, vError = io.Copy(pWriter, vResponse.Body)
	defer vResponse.Body.Close()
	if vError != nil {
		return diagnostic.NewError("Error downloading %s", vError, pURL)
	}
	return nil
}
func ( vSelf * OneDriveClient ) DoRequestDownload ( pMethod string , pURL string , pWriter io . Writer ) ( vRisError error ) { var vURL string if strings . Contains ( pURL , " " ) { vURL = pURL } else { vURL = " " + pURL } vRequest , vError := http . NewRequest ( pMethod , vURL , nil ) if vError != nil { return diagnostic . NewError ( " " , vError , pURL ) } vResponse , vError := vSelf . doRequest ( vRequest , 0 ) if vError != nil { return diagnostic . NewError ( " " , vError , pURL ) } _ , vError = io . Copy ( pWriter , vResponse . Body ) defer vResponse . Body . Close ( ) if vError != nil { return diagnostic . NewError ( " " , vError , pURL ) } return nil }
DoRequestDownload execute an http request to download an item
parameters:
pMethod = http request method (GET,..)
pUrl = request url
pWriter = response body writer
returns:
error in case of error
DoRequestDownload execute an http request to download an item parameters : pMethod = http request method ( GET .. ) pUrl = request url pWriter = response body writer returns : error in case of error