Class

# VMware_VCloud_SDK_Http_Client

class VMware_VCloud_SDK_Http_Client implements VMware_VCloud_SDK_Http_Client_Interface

## Methods

| __construct() Constructor, creates a new HTTP_Request2 instance. |
null | setAuth(array $auth) Set the login user name and password. |
| setConfig(array $config) Set the HTTP configurations |
| setAPIVersion(array $apiVersion) Set the API Version |
String | getVcloudToken() Gets the vcloud token |
| setVcloudToken(string $vcloudToken) Sets the vcloud token |
VMware_VCloud_SDK_Http_Response_Interface | get(string $url, array $headers = null) Send an HTTP GET request. |
VMware_VCloud_SDK_Http_Response_Interface | post(string $url, array $headers = null, mixed $data = null) Send an HTTP POST request. |
VMware_VCloud_SDK_Http_Response_Interface | put(string $url, array $headers = null, mixed $data = null) Send an HTTP PUT request. |
VMware_VCloud_SDK_Http_Response_Interface|null | delete(string $url) Send an HTTP DELETE request. |
null | download(string $url, array $headers, string $dest) Download a file and dump to specified location. |
null | upload(string $url, array $headers, string $file, int $windowSize = 10485760, function $onProgress = false) Upload a file. |
| putAndCheck($url, $headers, $data, $attemptNumber, $sendAttempts = 5) |
string | getUsername() |
Returns | getToken() |

## Details

###
at line 35
`public __construct()`

Constructor, creates a new HTTP_Request2 instance.

###
at line 49
`public null setAuth(array $auth)`

Set the login user name and password.

#### Parameters

array | $auth | In array('username'=>, 'password'=>) format

#### Return Value

null |

#### Exceptions

VMware_VCloud_SDK_Http_Exception |

###
at line 71
`public setConfig(array $config)`

Set the HTTP configurations

#### Parameters

array | $config | An HTTP configuration array

###
at line 82
`public setAPIVersion(array $apiVersion)`

Set the API Version

#### Parameters

array | $apiVersion | An API Version

###
at line 94
`public String getVcloudToken()`

Gets the vcloud token

#### Return Value

String |

###
at line 108
`public setVcloudToken(string $vcloudToken)`

Sets the vcloud token

#### Parameters

string | $vcloudToken |

###
at line 177
`public VMware_VCloud_SDK_Http_Response_Interface get(string $url, array $headers = null)`

Send an HTTP GET request.

#### Parameters

string | $url | URL to send an HTTP request
array | $headers | HTTP request headers

#### Return Value

VMware_VCloud_SDK_Http_Response_Interface |

###
at line 193
`public VMware_VCloud_SDK_Http_Response_Interface post(string $url, array $headers = null, mixed $data = null)`

Send an HTTP POST request.

#### Parameters

string | $url | URL to send an HTTP request
array | $headers | HTTP request headers
mixed | $data | HTTP request body

#### Return Value

VMware_VCloud_SDK_Http_Response_Interface |

###
at line 210
`public VMware_VCloud_SDK_Http_Response_Interface put(string $url, array $headers = null, mixed $data = null)`

Send an HTTP PUT request.

#### Parameters

string | $url | URL to send an HTTP request
array | $headers | HTTP request headers
mixed | $data | HTTP request body

#### Return Value

VMware_VCloud_SDK_Http_Response_Interface |

###
at line 225
`public VMware_VCloud_SDK_Http_Response_Interface|null delete(string $url)`

Send an HTTP DELETE request.

#### Parameters

string | $url | URL to send an HTTP request

#### Return Value

VMware_VCloud_SDK_Http_Response_Interface|null |

###
at line 240
`public null download(string $url, array $headers, string $dest)`

Download a file and dump to specified location.

#### Parameters

string | $url | Download source
array | $headers | HTTP request headers
string | $dest | Destination of the file to write to

#### Return Value

null |

###
at line 258
`public null upload(string $url, array $headers, string $file, int $windowSize = 10485760, function $onProgress = false)`

Upload a file.

#### Parameters

string | $url | Target where to upload the file
array | $headers | HTTP request headers
string | $file | Full path of the file to be uploaded
int | $windowSize | Chunk size in bytes, defaults to 10M
function | $onProgress | @yconan

#### Return Value

null |

###
at line 319
`public putAndCheck($url, $headers, $data, $attemptNumber, $sendAttempts = 5)`

#### Parameters

| $url |
| $headers |
| $data |
| $attemptNumber |
| $sendAttempts |

###
at line 339
`public string getUsername()`

#### Return Value

string | Returns the vCloud username@organization

###
at line 349
`public Returns getToken()`

#### Return Value

Returns | the vCloud authentication token