<a id=“SuperOffice_WebApi_Agents_AgentBase”></a> Class AgentBase
Namespace: SuperOffice.WebApi.AgentsAssembly: SuperOffice.WebApi.dll Base class for client Agents. Uses a <xref href=“System.Net.Http.HttpClient” data-throw-if-not-resolved=“false”></xref> to call the SuperOffice REST API. Will use a default implementation with gzip and progress callbacks if nothing is specified.
Inheritance
object ← AgentBaseDerived
AIAgent, ApiAgent, AppointmentAgent, ArchiveAgent, AssociateAgent, BLOBAgent, BatchAgent, BulkUpdateAgent, CRMScriptAgent, ChatAgent, ConfigurationAgent, ContactAgent, CustomObjectAgent, CustomerServiceAgent, DashAgent, DashboardAgent, DatabaseAgent, DatabaseTableAgent, DiagnosticsAgent, DocumentAgent, DocumentMigrationAgent, EMailAgent, ErpSyncAgent, FavouriteAgent, FindAgent, ForeignSystemAgent, FreeTextAgent, ImportAgent, LicenseAgent, ListAgent, MDOAgent, MarketingAgent, MessagingAgent, NavigatorAgent, NewsFeedAgent, NumberAllocationAgent, PersonAgent, PhoneListAgent, PocketAgent, PreferenceAgent, PreviewsAgent, ProjectAgent, QuoteAgent, RelationAgent, ReportAgent, ResourceAgent, SaintAgent, SaleAgent, SelectionAgent, SentryAgent, TargetsAgent, TicketAgent, TimeZoneAgent, TooltipsAgent, UserAgent, UserDefinedFieldInfoAgent, ViewStateAgent, WebhookAgent, WorkflowAgentImplements
IAgentBase, IDisposableInherited Members
object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()Remarks
Disposes of the client when the agent is disposed, if no client provided to ctor.Constructors
<a id=“SuperOffice_WebApi_Agents_AgentBase__ctor_System_String_System_Net_Http_HttpClient_”></a> AgentBase(string, HttpClient)
Agent base class.Parameters
baseUrl string
URL to web API endpoint
httpClient HttpClient
client to use to communicate with endpoint. Will make a default http client if nothing is provided.
<a id=“SuperOffice_WebApi_Agents_AgentBase__ctor_SuperOffice_WebApi_WebApiOptions_System_Net_Http_HttpClient_”></a> AgentBase(WebApiOptions, HttpClient)
Agent base class.Parameters
configuration WebApiOptions
Settings and URL to web API endpoint
httpClient HttpClient
client to use to communicate with endpoint. Will make a default http client if nothing is provided.
Fields
<a id=“SuperOffice_WebApi_Agents_AgentBase__binary”></a> _binary
Field Value
string<a id=“SuperOffice_WebApi_Agents_AgentBase__client”></a> _client
Field Value
HttpClient<a id=“SuperOffice_WebApi_Agents_AgentBase__config”></a> _config
Field Value
WebApiOptions<a id=“SuperOffice_WebApi_Agents_AgentBase__disposeClient”></a> _disposeClient
Field Value
bool<a id=“SuperOffice_WebApi_Agents_AgentBase__json”></a> _json
Field Value
stringProperties
<a id=“SuperOffice_WebApi_Agents_AgentBase_Client”></a> Client
The HTTP Client we are using. Create a default SO HttpClient if not specified in constructor.Property Value
HttpClient<a id=“SuperOffice_WebApi_Agents_AgentBase_ClientCancellationTokenSource”></a> ClientCancellationTokenSource
Used in SendRequest to allow clients to cancel requests.Property Value
CancellationTokenSource<a id=“SuperOffice_WebApi_Agents_AgentBase_Configuration”></a> Configuration
Configuration this agent was initalized with.Property Value
WebApiOptions<a id=“SuperOffice_WebApi_Agents_AgentBase_HasRunningRequest”></a> HasRunningRequest
Is an HTTP request in flight?Property Value
bool<a id=“SuperOffice_WebApi_Agents_AgentBase_ProgressListener”></a> ProgressListener
Progress callback receiver for downloadsProperty Value
IProgressListener<a id=“SuperOffice_WebApi_Agents_AgentBase_UploadProgressListener”></a> UploadProgressListener
Progress callback receiver for uploadsProperty Value
IProgressListenerMethods
<a id=“SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_”></a> BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string)
Parameters
method HttpMethod
url string
body object
config WebApiOptions
contentType string
Returns
HttpRequestMessage<a id=“SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_”></a> BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)
Parameters
method HttpMethod
url string
body object
stream Stream
config WebApiOptions
contentType string
Returns
HttpRequestMessage<a id=“SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromStream_System_Net_Http_HttpMethod_System_String_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_”></a> BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string)
Parameters
method HttpMethod
url string
body Stream
config WebApiOptions
contentType string
Returns
HttpRequestMessage<a id=“SuperOffice_WebApi_Agents_AgentBase_CancelRequest”></a> CancelRequest()
Used by the client to terminate the current method call.<a id=“SuperOffice_WebApi_Agents_AgentBase_Dispose”></a> Dispose()
Disposes of the HTTP Client if we own it.<a id=“SuperOffice_WebApi_Agents_AgentBase_Finally_SuperOffice_WebApi_RequestOptions_”></a> Finally(RequestOptions)
Parameters
options RequestOptions
<a id=“SuperOffice_WebApi_Agents_AgentBase_Merge_SuperOffice_WebApi_RequestOptions_”></a> Merge(RequestOptions)
Parameters
options RequestOptions
Returns
WebApiOptions<a id=“SuperOffice_WebApi_Agents_AgentBase_ParseAuthorization_SuperOffice_WebApi_Authorization_IAuthorization_”></a> ParseAuthorization(IAuthorization)
Creates authentication headers based on <xref href=“SuperOffice.WebApi.Authorization.IAuthorization” data-throw-if-not-resolved=“false”></xref> scheme and parameter.Parameters
authorization IAuthorization
Contains authorization scheme and parameter values.
Returns
AuthenticationHeaderValue Authorization header.<a id=“SuperOffice_WebApi_Agents_AgentBase_ParseResponse__1_System_Net_Http_HttpResponseMessage_”></a> ParseResponse<T>(HttpResponseMessage)
Parameters
response HttpResponseMessage
Returns
Task<T>Type Parameters
T
<a id=“SuperOffice_WebApi_Agents_AgentBase_SendRequest_System_Net_Http_HttpRequestMessage_SuperOffice_WebApi_RequestOptions_”></a> SendRequest(HttpRequestMessage, RequestOptions)
Parameters
request HttpRequestMessage
config RequestOptions
Returns
Task<HttpResponseMessage><a id=“SuperOffice_WebApi_Agents_AgentBase_SendRequestObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_”></a> SendRequestObject(HttpMethod, string, object, WebApiOptions, string)
Parameters
method HttpMethod
url string
args object
config WebApiOptions
contentType string
Returns
Task<HttpResponseMessage><a id=“SuperOffice_WebApi_Agents_AgentBase_SendRequestObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_”></a> SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)
Parameters
method HttpMethod
url string
args object
stream Stream
config WebApiOptions
contentType string
Returns
Task<HttpResponseMessage><a id=“SuperOffice_WebApi_Agents_AgentBase_ThrowOnResponseErrorAsync_System_Net_Http_HttpRequestMessage_System_Net_Http_HttpResponseMessage_”></a> ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage)
Return NULL on NOT-FOUND errorsParameters
request HttpRequestMessage
response HttpResponseMessage