Google APIs Client Library for C++
|
Base class for denoting a cloud service. More...
#include "client/service/client_service.h"
Public Member Functions | |
ClientService (const StringPiece &root_url, const StringPiece &service_path, HttpTransport *transport) | |
Constructs a service instance acting as a proxy to a given service endpoint. | |
virtual | ~ClientService () |
Standard destructor. | |
const StringPiece & | url_root () const |
Returns the bound url_root attribute. | |
const StringPiece & | url_path () const |
Returns the bound url_path attribute. | |
const string & | service_url () const |
Returns the complete url to the service. | |
void | ChangeServiceUrl (const StringPiece &url_root, const StringPiece &url_path) |
Allows you to change the service_url. | |
HttpTransport * | transport () const |
Returns the transport instance bound in the constructor. |
Base class for denoting a cloud service.
A ClientService is a proxy to some service endpoint in the cloud. It acts as a Facade to a particular service and Factory for specific ClientServiceRequest instances to make requests of specific service interfaces. There are no service methods common across all services so the base class has an empty Facade and no requests to provide a factory for. The specialized subclasses are more interesting with regard to these roles.
ClientService | ( | const StringPiece & | root_url, |
const StringPiece & | service_path, | ||
HttpTransport * | transport | ||
) |
Constructs a service instance acting as a proxy to a given service endpoint.
[in] | root_url | The root_url to access the given service. Usually this is for the webserver that is hosting the service. |
[in] | service_path | The additional path to append to the url to get at the particular service. |
[in] | transport | A transport instance to use when sending requests to the service. The service instance will take ownership of the transport. |
virtual ~ClientService | ( | ) | [virtual] |
Standard destructor.
void ChangeServiceUrl | ( | const StringPiece & | url_root, |
const StringPiece & | url_path | ||
) |
Allows you to change the service_url.
This method is intended as a hook to change the service_url location from the default constructor, especially of specialized services that might be created elsewhere. It is intended to point to a different instance or location, such as for testing or staging.
If you are going to change the URL, you should do so before you start creating requests to send to it.
[in] | url_root | The root url for the web server. |
[in] | url_path | the path in the root_url for the service. The service_url will be JoinPath(url_root,url_path) |
const string& service_url | ( | ) | const [inline] |
Returns the complete url to the service.
HttpTransport* transport | ( | ) | const [inline] |
Returns the transport instance bound in the constructor.
const StringPiece& url_path | ( | ) | const [inline] |
Returns the bound url_path attribute.
const StringPiece& url_root | ( | ) | const [inline] |
Returns the bound url_root attribute.