public abstract class ClientServiceRequest<TResponse> : ClientServiceRequest, IClientServiceRequest<TResponse>, IClientServiceRequest
Represents an abstract, strongly typed request base class to make requests to a service. Supports a strongly typed response.
Namespace
Google.Apis.RequestsAssembly
Google.Apis.dll
Type Parameter | |
---|---|
Name | Description |
TResponse | The type of the response object |
Constructors
ClientServiceRequest(IClientService)
protected ClientServiceRequest(IClientService service)
Creates a new service request.
Parameter | |
---|---|
Name | Description |
service | IClientService |
Properties
ETagAction
public ETagAction ETagAction { get; set; }
Defines whether the E-Tag will be used in a specified way or be ignored.
Property Value | |
---|---|
Type | Description |
ETagAction |
HttpMethod
public abstract string HttpMethod { get; }
Gets the HTTP method of this request.
Property Value | |
---|---|
Type | Description |
String |
MethodName
public abstract string MethodName { get; }
Gets the name of the method to which this request belongs.
Property Value | |
---|---|
Type | Description |
String |
ModifyRequest
public Action<HttpRequestMessage> ModifyRequest { get; set; }
Gets or sets the callback for modifying HTTP requests made by this service request.
Property Value | |
---|---|
Type | Description |
Action<HttpRequestMessage> |
RequestParameters
public IDictionary<string, IParameter> RequestParameters { get; }
Gets the parameters information for this specific request.
Property Value | |
---|---|
Type | Description |
IDictionary<String, IParameter> |
RestPath
public abstract string RestPath { get; }
Gets the rest path of this request.
Property Value | |
---|---|
Type | Description |
String |
Service
public IClientService Service { get; }
Gets the service which is related to this request.
Property Value | |
---|---|
Type | Description |
IClientService |
ValidateParameters
public bool? ValidateParameters { get; set; }
Override for service-wide validation configuration in ValidateParameters. If this is null (the default) then the value from the service initializer is used to determine whether or not parameters should be validated client-side. If this is non-null, it overrides whatever value is specified in the service.
Property Value | |
---|---|
Type | Description |
Nullable<Boolean> |
Methods
CreateRequest(Nullable<Boolean>)
public HttpRequestMessage CreateRequest(bool? overrideGZipEnabled = null)
Creates a HTTP request message with all path and query parameters, ETag, etc.
Parameter | |
---|---|
Name | Description |
overrideGZipEnabled | Nullable<Boolean> If |
Returns | |
---|---|
Type | Description |
HttpRequestMessage |
Execute()
public TResponse Execute()
Executes the request and returns the result object.
Returns | |
---|---|
Type | Description |
TResponse |
ExecuteAsStream()
public Stream ExecuteAsStream()
Executes the request and returns the result stream.
Returns | |
---|---|
Type | Description |
Stream |
ExecuteAsStreamAsync()
public async Task<Stream> ExecuteAsStreamAsync()
Executes the request asynchronously and returns the result stream.
Returns | |
---|---|
Type | Description |
Task<Stream> |
ExecuteAsStreamAsync(CancellationToken)
public async Task<Stream> ExecuteAsStreamAsync(CancellationToken cancellationToken)
Executes the request asynchronously and returns the result stream.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken A cancellation token to cancel operation. |
Returns | |
---|---|
Type | Description |
Task<Stream> |
ExecuteAsync()
public async Task<TResponse> ExecuteAsync()
Executes the request asynchronously and returns the result object.
Returns | |
---|---|
Type | Description |
Task<TResponse> |
ExecuteAsync(CancellationToken)
public async Task<TResponse> ExecuteAsync(CancellationToken cancellationToken)
Executes the request asynchronously and returns the result object.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken A cancellation token to cancel operation. |
Returns | |
---|---|
Type | Description |
Task<TResponse> |
GenerateRequestUri()
protected string GenerateRequestUri()
Generates the right URL for this request.
Returns | |
---|---|
Type | Description |
String |
GetBody()
protected virtual object GetBody()
Returns the body of this request.
Returns | |
---|---|
Type | Description |
Object | The body of this request. |
GetDefaultETagAction(String)
public static ETagAction GetDefaultETagAction(string httpMethod)
Returns the default ETagAction for a specific HTTP verb.
Parameter | |
---|---|
Name | Description |
httpMethod | String |
Returns | |
---|---|
Type | Description |
ETagAction |
InitParameters()
protected virtual void InitParameters()
Initializes request's parameters. Inherited classes MUST override this method to add parameters to the RequestParameters dictionary.