Class

# VMware_VCloud_SDK_Service_Abstract

abstract class VMware_VCloud_SDK_Service_Abstract

## Methods

null | setHttpClient(VMware_VCloud_SDK_Http_Client $httpClient) Set the HTTP client object to use for retrieving the feeds. |
VMware_VCloud_SDK_Http_Client | getHttpClient() Gets the HTTP client object. |
String | getToken() Gets the vcloud token |
| setToken(string $vcloudToken) Sets the vcloud token |
mixed | get(string $url, string $type = '', boolean $reObj = true, string $return = null) Sets HTTP configuration |
mixed | post(string $url, int $expect = null, string $type = null, mixed $data = null, string $return = null, string $auth = null) Send an HTTP POST request. |
mixed | put(string $url, int $expect = null, string $type = null, mixed $data = null) Send an HTTP PUT request. |
VMware_VCloud_API_TaskType|null | delete(string $url, int $expect = null) Send an HTTP DELETE request. |
mixed | refetch(mixed $obj) Refetch the given VMware vCloud data object from vCloud. |
null | download(string $url, string $dest, string $type = 'application/octet-stream') Download a file and dump to specified location. |
null | upload(string $url, string $file, string $type = 'application/octet-stream', function $onProgress = false) Upload a file. |

## Details

###
at line 17
`final public null setHttpClient(VMware_VCloud_SDK_Http_Client $httpClient)`

Set the HTTP client object to use for retrieving the feeds.

If null, use the default client, the VMwareVCloudSDKHttpClient object.

#### Parameters

VMware_VCloud_SDK_Http_Client | $httpClient |

#### Return Value

null |

###
at line 28
`final public VMware_VCloud_SDK_Http_Client getHttpClient()`

Gets the HTTP client object.

#### Return Value

VMware_VCloud_SDK_Http_Client |

###
at line 75
`final public String getToken()`

Gets the vcloud token

#### Return Value

String |

###
at line 87
`final public setToken(string $vcloudToken)`

Sets the vcloud token

#### Parameters

string | $vcloudToken |

###
at line 104
`public mixed get(string $url, string $type = '', boolean $reObj = true, string $return = null)`

Sets HTTP configuration

#### Parameters

string | $url | URL to send an HTTP request
string | $type | The HTTP request Content-type
boolean | $reObj | Indicates whether return a vCloud data object (true) or response body (false)
string | $return | Expected response data type name

#### Return Value

mixed | VMware vCloud data object or response body

#### Exceptions

VMware_VCloud_SDK_Exception |

###
at line 134
`public mixed post(string $url, int $expect = null, string $type = null, mixed $data = null, string $return = null, string $auth = null)`

Send an HTTP POST request.

#### Parameters

string | $url | URL to send an HTTP request
int | $expect | Expected HTTP status code on a successful request
string | $type | HTTP request Content-Type
mixed | $data | A vCloud data object which has export() method defined, or an XML data which will be used as an HTTP request body
string | $return | Expected response data type name
string | $auth | Authorization token

#### Return Value

mixed | A VMware vCloud data object

#### Exceptions

VMware_VCloud_SDK_Exception |

###
at line 177
`public mixed put(string $url, int $expect = null, string $type = null, mixed $data = null)`

Send an HTTP PUT request.

#### Parameters

string | $url | URL to send an HTTP request
int | $expect | Expected HTTP status code on a successful request
string | $type | HTTP request Content-Type
mixed | $data | A VMware vCloud data object, which has export() method defined, or an XML data which will be used as HTTP request body

#### Return Value

mixed | A VMware vCloud data object

#### Exceptions

VMware_VCloud_SDK_Exception |

###
at line 210
`public VMware_VCloud_API_TaskType|null delete(string $url, int $expect = null)`

Send an HTTP DELETE request.

#### Parameters

string | $url | URL to send an HTTP request
int | $expect | Expected HTTP status code on a successful request

#### Return Value

VMware_VCloud_API_TaskType|null |

#### Exceptions

VMware_VCloud_SDK_Exception |

###
at line 231
`public mixed refetch(mixed $obj)`

Refetch the given VMware vCloud data object from vCloud.

#### Parameters

mixed | $obj | A VMware vCloud data object to be refeched. The data object should have an href attribute.

#### Return Value

mixed | A VMware vCloud data object

###
at line 252
`public null download(string $url, string $dest, string $type = 'application/octet-stream')`

Download a file and dump to specified location.

#### Parameters

string | $url | Source of the file
string | $dest | Destination of the file to write to
string | $type | HTTP request Content-Type

#### Return Value

null |

###
at line 269
`public null upload(string $url, string $file, string $type = 'application/octet-stream', function $onProgress = false)`

Upload a file.

#### Parameters

string | $url | Target to upload the file
string | $file | Full path of a file to be uploaded
string | $type | HTTP request Content-Type
function | $onProgress | @yconan

#### Return Value

null |

#### Exceptions

VMware_VCloud_SDK_Exception |