Skip to main content

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent”></a> Class DiagnosticsAgent

Namespace: SuperOffice.WebApi.Agents
Assembly: SuperOffice.WebApi.dll
Diagnostics, usage data collection, caches and flushing

Inheritance

objectAgentBaseDiagnosticsAgent

Implements

IDiagnosticsAgent, IAgentBase, IDisposable

Inherited Members

AgentBase._json, AgentBase._binary, AgentBase._config, AgentBase._client, AgentBase._disposeClient, AgentBase.Merge(RequestOptions), AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string), AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.ParseAuthorization(IAuthorization), AgentBase.CancelRequest(), AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string), AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string), AgentBase.SendRequest(HttpRequestMessage, RequestOptions), AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage), AgentBase.ParseResponse<T&gt;(HttpResponseMessage), AgentBase.Finally(RequestOptions), AgentBase.Dispose(), AgentBase.Configuration, AgentBase.Client, AgentBase.HasRunningRequest, AgentBase.ClientCancellationTokenSource, AgentBase.ProgressListener, AgentBase.UploadProgressListener, object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()

Examples

<pre><code class=“lang-csharp”>using SuperOffice.WebApi; using SuperOffice.WebApi.Agents; var mySession = new WebApiOptions(“http://example.com/super/api”); mySession.Authorization = new AuthorizationUsernamePassword(“user”, “pass”); using (DiagnosticsAgent agent = new DiagnosticsAgent(mySession)) { // call methods on agent here… }</code></pre>

Constructors

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent__ctor_System_Net_Http_HttpClient_”></a> DiagnosticsAgent(HttpClient)

Constructor: Diagnostics, usage data collection, caches and flushing

Parameters

httpClient HttpClient Use this HTTP client instead of making own HttpClient instance.

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent__ctor_SuperOffice_WebApi_WebApiOptions_System_Net_Http_HttpClient_”></a> DiagnosticsAgent(WebApiOptions, HttpClient)

Constructor: Diagnostics, usage data collection, caches and flushing

Parameters

options WebApiOptions Base URL and authentication values. httpClient HttpClient Optional: Use this HTTP client instead of making a new one.

Methods

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_AddWebAppUsageAsync_SuperOffice_WebApi_Data_WebAppUsage___SuperOffice_WebApi_RequestOptions_”></a> AddWebAppUsageAsync(WebAppUsage[], RequestOptions)

Adds WebApp usage to existing log

Parameters

webAppUsages WebAppUsage[] Web app usage. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_ChangeLogSettingsAsync_System_Boolean_System_Boolean_System_Boolean_System_Boolean_System_Boolean_System_Boolean_System_Boolean_System_Boolean_SuperOffice_WebApi_RequestOptions_”></a> ChangeLogSettingsAsync(bool, bool, bool, bool, bool, bool, bool, bool, RequestOptions)

Change NetServer log settings.

Parameters

logWarning bool Turn on warning log logInformation bool Turn on information log logSuccessAudit bool Turn on success audit log logFailureAudit bool Turn on failure audit log logToEventLog bool Log to event log logToSuperOffice bool Log to SuperOffice logToFile bool Log to file logToTrace bool Log to trace requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_CollectDataAdditionsAsync_SuperOffice_WebApi_RequestOptions_”></a> CollectDataAdditionsAsync(RequestOptions)

Collect and transmit usage statistics: Database Additions. If opted-out then this call does nothing. The call returns immediately (starting a background thread), and updates CS scheduler table to set the next run time.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_CollectTableSizesAsync_SuperOffice_WebApi_RequestOptions_”></a> CollectTableSizesAsync(RequestOptions)

Collect and transmit usage statistics: Table Sizes. If opted-out then this call does nothing. The call returns immediately (starting a background thread), and updates CS scheduler table to set the next run time.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_CollectWebUsageAsync_SuperOffice_WebApi_RequestOptions_”></a> CollectWebUsageAsync(RequestOptions)

Collect and transmit usage statistics: Web-based clients Usage. If opted-out then this call does nothing. The call returns immediately (starting a background thread), and updates CS scheduler table to set the next run time.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_CollectWinUsageAsync_SuperOffice_WebApi_RequestOptions_”></a> CollectWinUsageAsync(RequestOptions)

Collect and transmit usage statistics: Windows CRM Client Usage. If opted-out then this call does nothing. The call returns immediately (starting a background thread), and updates CS scheduler table to set the next run time.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_FlushCachesAsync_SuperOffice_WebApi_RequestOptions_”></a> FlushCachesAsync(RequestOptions)

Flushes all NetServer caches

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_FlushCachesByNameAsync_System_String___SuperOffice_WebApi_RequestOptions_”></a> FlushCachesByNameAsync(string[], RequestOptions)

Flushes all NetServer caches named

Parameters

cacheNames string[] Name of the cachnes to flush requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_GetAnalyticsDataAsync_SuperOffice_WebApi_RequestOptions_”></a> GetAnalyticsDataAsync(RequestOptions)

Retrieve analytics properties to be included in usage tracking.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AnalyticsData&gt; Description Analytics Data

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_GetCacheInvalidationGenerationsAsync_System_String___SuperOffice_WebApi_RequestOptions_”></a> GetCacheInvalidationGenerationsAsync(string[], RequestOptions)

Get generation for provided names

Parameters

names string[] Name of caches requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<CacheInvalidation[]&gt; Array of caches with generation number

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_GetCacheNamesAsync_SuperOffice_WebApi_RequestOptions_”></a> GetCacheNamesAsync(RequestOptions)

Get the name of the caches that can be flushed

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string[]&gt; Name of the caches that can be flusehd

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_GetCacheStateAsync_System_String___SuperOffice_WebApi_RequestOptions_”></a> GetCacheStateAsync(string[], RequestOptions)

Get the current generation value of the named caches. State is opaque.

Parameters

cacheNames string[] Names of the caches to check requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; Current state of the caches named. If not the same as previous value, then it is time to flush

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_GetEntityCountsForAllUsersAsync_SuperOffice_WebApi_RequestOptions_”></a> GetEntityCountsForAllUsersAsync(RequestOptions)

Get an array of entities and number of entities created for all associates.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<EntityCounts[]&gt; Array of EntityCounts[] for all the users

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_GetEntityCountsForCurrentUserAsync_SuperOffice_WebApi_RequestOptions_”></a> GetEntityCountsForCurrentUserAsync(RequestOptions)

Get an array of entities and number of entities created for the current associate

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<EntityCounts[]&gt; Array of EntityCounts[] for the current associate

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_GetNextTableNumberAsync_SuperOffice_WebApi_RequestOptions_”></a> GetNextTableNumberAsync(RequestOptions)

Increment save and return NextTableNumber, to be used when creating new extra table

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; NextTableNumber of DatabaseModel

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_GetSystemMessagesAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetSystemMessagesAsync(int, RequestOptions)

Retrieves a list of system messages for a specific associate.

Parameters

associateId int The associateId of the message target. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<SystemMessage[]&gt; List of SystemMessages for desired associate

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_GetWebAppUsagesForPeriodAsync_System_DateTime_System_DateTime_System_String_SuperOffice_WebApi_RequestOptions_”></a> GetWebAppUsagesForPeriodAsync(DateTime, DateTime, string, RequestOptions)

Get all WebAppUsages for a given period, that match an optional search term

Parameters

fromDate DateTime toDate DateTime searchTerm string ViewState search term. ’%’ is the wildcard character, for example ‘Pocket%’ will match all viewstates starting with ‘Pocket’. If empty, all viewstates will be matched requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<WebAppUsage[]&gt;

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_LogViewStateAsync_System_String_SuperOffice_WebApi_RequestOptions_”></a> LogViewStateAsync(string, RequestOptions)

Log a change in view state. The granularity of the logging depends on the current configuration. This call returns asynchronously, leaving the server to finish processing later on.

Parameters

viewState string Current view state to be logged requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_PerformTasksAfterCustomObjectTableCreatedAsync_System_String_SuperOffice_WebApi_RequestOptions_”></a> PerformTasksAfterCustomObjectTableCreatedAsync(string, RequestOptions)

A temporary method to be used from c++ until CustomObjectsAgent.CreateTable implemented in NetServer

Parameters

tableName string Name of DB table of the custom object that was created. E.g., ‘y_car’ requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_PerformTasksAfterCustomObjectTableDeletedAsync_System_String_SuperOffice_WebApi_RequestOptions_”></a> PerformTasksAfterCustomObjectTableDeletedAsync(string, RequestOptions)

A temporary method to be used from c++ until CustomObjectsAgent.DeleteTable implemented in NetServer

Parameters

tableName string Name of DB table of the custom object that was deleted. E.g., ‘y_car’ requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_PerformTasksAfterUpgradeAsync_SuperOffice_WebApi_RequestOptions_”></a> PerformTasksAfterUpgradeAsync(RequestOptions)

After upgrading to a new fileset, there may be tasks that need to be done. Examples - import new TypicalSearches, if present. Tasks performed here need to be idempotent and independent of the actual upgrade jump (what was the previous version). They should complete in a reasonable time, not more than a few minutes maximum.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<string&gt; Message that can be shown to the user, summarizing what has been done, if anything.

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_RegisterClosedTicketsUsageAsync_System_Int32___SuperOffice_WebApi_RequestOptions_”></a> RegisterClosedTicketsUsageAsync(int[], RequestOptions)

Logs and registers resolved ticket count to the metering service

Parameters

ticketIds int[] IDs of closed tickets requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_RemoveExpiredSystemMessagesAsync_SuperOffice_WebApi_RequestOptions_”></a> RemoveExpiredSystemMessagesAsync(RequestOptions)

Deletes expired system messages.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_RemoveSystemMessageAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> RemoveSystemMessageAsync(int, string, RequestOptions)

Removes a system message for current associate

Parameters

onlineappId int Id of the online app that owns this message systemMessageId string Message identifier, used for message removal requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_RemoveSystemMessageForAssociateAsync_System_Int32_System_String_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> RemoveSystemMessageForAssociateAsync(int, string, int, RequestOptions)

Removes a system message for specific associate.

Parameters

onlineappId int Id of the online app that owns this message systemMessageId string Message identifier, used for message update or removal associateId int The associateId of the message target. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_ResyncUsersAsync_SuperOffice_WebApi_RequestOptions_”></a> ResyncUsersAsync(RequestOptions)

Resynchronize user information with SuperOffice Community, if opted-out then this call does nothing. The call returns immediately (starting a background thread), and updates CS scheduler table to set the next run time.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task This method has no return value

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_SendSystemMessageAsync_System_String_System_Int32_System_String_System_DateTime_SuperOffice_WebApi_Data_SystemMessageType_SuperOffice_WebApi_RequestOptions_”></a> SendSystemMessageAsync(string, int, string, DateTime, SystemMessageType, RequestOptions)

Adds a system message for a specific associate.

Parameters

systemMessageId string The message string id associateId int The associateId of the message target. markdownMessage string Markdown message to be displayed to the user expire DateTime When the message will no longer be available type SystemMessageType Type of message, example: info, warning, error requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_TrackEventAsync_System_String_SuperOffice_WebApi_Data_StringDictionary_SuperOffice_WebApi_RequestOptions_”></a> TrackEventAsync(string, StringDictionary, RequestOptions)

Sends events to Amplitude and Userflow.

Parameters

trackEventName string “Sale Completed” or “Sale Sold” etc. See the TrackEventNames class for suitable string constants. eventProperties StringDictionary key-value pairs of event properties. client is set from the application token. Special keys: app_version, platform, os_name, os_version, device_brand, device_manufacturer requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<long&gt; Amplitude Session id used to track the event. May be the same as passed in SO-AMPLITUDE header or ampSess cookie, or a fresh one if none defined.

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_TrackUserAsync_SuperOffice_WebApi_Data_StringDictionary_SuperOffice_WebApi_RequestOptions_”></a> TrackUserAsync(StringDictionary, RequestOptions)

Sends user identification to Amplitude and Userflow. Sets current rights, user licenses automatically. Additional properties can be specified in userProperties.

Parameters

userProperties StringDictionary Optional: Additional key-value pairs of user properties to set on the user. Special keys: app_version, platform, os_name, os_version, device_brand, device_manufacturer requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<long&gt; Amplitude Session id used to track the user. May be the same as passed in SO-AMPLITUDE header or ampSess cookie, or a fresh one if none defined.

<a id=“SuperOffice_WebApi_Agents_DiagnosticsAgent_WebAppUsageExistsInPeriodAsync_System_Int32_System_String_System_DateTime_SuperOffice_WebApi_RequestOptions_”></a> WebAppUsageExistsInPeriodAsync(int, string, DateTime, RequestOptions)

Returns true if viewState has been clicked at least once since FromDate, if asscoiateId < 0 or FromDate is DateTime.MinValue no restriction given for those parameters

Parameters

associateId int The asscoiate id to look for webapp usage viewState string The viewState to search for fromDate DateTime The datetime to restrict webapp usage on requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<bool&gt; Returns true if viewState has been clicked at least once since FromDate