public abstract class BaseClientService : IClientService, IDisposable
A base class for a client service which provides common mechanism for all services, like
serialization and GZip support. It should be safe to use a single service instance to make server requests
concurrently from multiple threads.
This class adds a special IHttpExecuteInterceptor to the
ConfigurableMessageHandler execute interceptor list, which uses the given
Authenticator. It calls to its applying authentication method, and injects the "Authorization" header in the
request.
If the given Authenticator implements IHttpUnsuccessfulResponseHandler, this
class adds the Authenticator to the ConfigurableMessageHandler's unsuccessful
response handler list.
Creates the back-off handler with ExponentialBackOff.
Overrides this method to change the default behavior of back-off handler (e.g. you can change the maximum
waited request's time span, or create a back-off handler with you own implementation of
IBackOff).
public void SetRequestSerailizedContent(HttpRequestMessage request, object body)
Sets the content of the request by the given body and the this service's configuration.
First the body object is serialized by the Serializer and then, if GZip is enabled, the content will be
wrapped in a GZip stream, otherwise a regular string stream will be used.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003e\u003ccode\u003eBaseClientService\u003c/code\u003e is an abstract base class for client services, offering common functionalities like serialization and GZip support, and it is designed to be thread-safe for concurrent server requests.\u003c/p\u003e\n"],["\u003cp\u003eThis class enhances \u003ccode\u003eConfigurableMessageHandler\u003c/code\u003e with an \u003ccode\u003eIHttpExecuteInterceptor\u003c/code\u003e that applies authentication by injecting the "Authorization" header, and it also adds an \u003ccode\u003eIHttpUnsuccessfulResponseHandler\u003c/code\u003e for handling unsuccessful responses.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBaseClientService\u003c/code\u003e offers various properties such as \u003ccode\u003eApiKey\u003c/code\u003e, \u003ccode\u003eApplicationName\u003c/code\u003e, \u003ccode\u003eBasePath\u003c/code\u003e, and \u003ccode\u003eBaseUri\u003c/code\u003e to manage service-related configurations, as well as it manages the \u003ccode\u003eGZipEnabled\u003c/code\u003e property, and the \u003ccode\u003eHttpClient\u003c/code\u003e for sending requests.\u003c/p\u003e\n"],["\u003cp\u003eThis service class can handle both serializing and deserializing data, specifically the serialization of an object into a string representation using \u003ccode\u003eSerializeObject\u003c/code\u003e, and the deserialization of both normal responses using \u003ccode\u003eDeserializeResponse<T>\u003c/code\u003e, and errors using \u003ccode\u003eDeserializeError\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe class includes methods like \u003ccode\u003eCreateBackOffHandler\u003c/code\u003e for customizing request retry behavior and \u003ccode\u003eSetRequestSerailizedContent\u003c/code\u003e for managing the request body content, also it allows setting a maximum URL length for GET requests via \u003ccode\u003eDefaultMaxUrlLength\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,[]]