<a id=“SuperOffice_WebApi_Agents_TargetsAgent”></a> Class TargetsAgent
Namespace: SuperOffice.WebApi.AgentsAssembly: SuperOffice.WebApi.dll Agent lets you configure targets, and retrieve targets
Inheritance
object ← AgentBase ← TargetsAgentImplements
ITargetsAgent, IAgentBase, IDisposableInherited 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>(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 (TargetsAgent agent = new TargetsAgent(mySession)) { // call methods on agent here… }</code></pre>Constructors
<a id=“SuperOffice_WebApi_Agents_TargetsAgent__ctor_System_Net_Http_HttpClient_”></a> TargetsAgent(HttpClient)
Constructor: Agent lets you configure targets, and retrieve targetsParameters
httpClient HttpClient
Use this HTTP client instead of making own HttpClient instance.
<a id=“SuperOffice_WebApi_Agents_TargetsAgent__ctor_SuperOffice_WebApi_WebApiOptions_System_Net_Http_HttpClient_”></a> TargetsAgent(WebApiOptions, HttpClient)
Constructor: Agent lets you configure targets, and retrieve targetsParameters
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_TargetsAgent_CreateDefaultTargetAssignmentAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetAssignmentAsync(RequestOptions)
Set default values into a new TargetAssignment. NetServer calculates default values on the entity, which is required when creating/storing a new instanceParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetAssignment> A blank TargetAssignment<a id=“SuperOffice_WebApi_Agents_TargetsAgent_CreateDefaultTargetAssignmentForCompanyAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetAssignmentForCompanyAsync(RequestOptions)
Returns a default target assignment for the owner company.Parameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetAssignment> Default target assignment for the owner company.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_CreateDefaultTargetAssignmentForCompanyWithDimensionAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetAssignmentForCompanyWithDimensionAsync(int, RequestOptions)
Returns a default target assignment for the owner company, for the specified dimension.Parameters
targetDimensionId int
The dimension id to use.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetAssignment[]> Default target assignments for the owner company.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_CreateDefaultTargetAssignmentForCompanyWithYearAndDimensionAsync_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetAssignmentForCompanyWithYearAndDimensionAsync(int, int, RequestOptions)
Returns a default target assignment for the owner company, for the specified year and dimension.Parameters
year int
The year from which to retrieve dimension data.
targetDimensionId int
The dimension id to use.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetAssignment[]> Default target assignments for the owner company.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_CreateDefaultTargetAssignmentForUserGroupAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetAssignmentForUserGroupAsync(int, RequestOptions)
Returns a default target assignment for the specified usergroup.Parameters
userGroupId int
The id of the UserGroup
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetAssignment[]> Default target assignment for the specified usergroup.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_CreateDefaultTargetAssignmentForUserGroupWithDimensionAsync_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetAssignmentForUserGroupWithDimensionAsync(int, int, RequestOptions)
Returns a default target assignment for the specified usergroup, for the specified dimension.Parameters
userGroupId int
The id of the UserGroup
targetDimensionId int
The dimension id to use.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetAssignment[]> Default target assignment for the specified usergroup.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_CreateDefaultTargetAssignmentForUserGroupWithYearAndDimensionAsync_System_Int32_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetAssignmentForUserGroupWithYearAndDimensionAsync(int, int, int, RequestOptions)
Returns a default target assignment for the specified usergroup, for the specified year and dimension.Parameters
userGroupId int
The id of the UserGroup
year int
The year from which to retrieve dimension data.
targetDimensionId int
The dimension id to use.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetAssignment[]> Default target assignment for the specified usergroup.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_CreateDefaultTargetDimensionAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetDimensionAsync(RequestOptions)
Set default values into a new TargetDimension. NetServer calculates default values on the entity, which is required when creating/storing a new instanceParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetDimension> A blank TargetDimension<a id=“SuperOffice_WebApi_Agents_TargetsAgent_CreateDefaultTargetGroupAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetGroupAsync(RequestOptions)
Set default values into a new TargetGroup. NetServer calculates default values on the entity, which is required when creating/storing a new instanceParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetGroup> A blank TargetGroup<a id=“SuperOffice_WebApi_Agents_TargetsAgent_CreateDefaultTargetRevisionAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetRevisionAsync(RequestOptions)
Set default values into a new TargetRevision. NetServer calculates default values on the entity, which is required when creating/storing a new instanceParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetRevision> A blank TargetRevision<a id=“SuperOffice_WebApi_Agents_TargetsAgent_CreateDefaultTargetRevisionHistoryAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultTargetRevisionHistoryAsync(RequestOptions)
Set default values into a new TargetRevisionHistory. NetServer calculates default values on the entity, which is required when creating/storing a new instanceParameters
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetRevisionHistory> A blank TargetRevisionHistory<a id=“SuperOffice_WebApi_Agents_TargetsAgent_DeleteTargetDimensionAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteTargetDimensionAsync(int, RequestOptions)
Deletes the TargetDimensionParameters
targetDimensionId int
The identity of the TargetDimension
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_TargetsAgent_DeleteTargetGroupAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteTargetGroupAsync(int, RequestOptions)
Deletes the TargetGroupParameters
targetGroupId int
The identity of the TargetGroup
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<a id=“SuperOffice_WebApi_Agents_TargetsAgent_ExportTargetGroupToExcelAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> ExportTargetGroupToExcelAsync(int, RequestOptions)
Renders the given targetgroup to excel, and returns the path to the temporary file.Parameters
targetGroupId int
The id of the targetgroup to be rendered to excel.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<ExportArchiveResult><a id=“SuperOffice_WebApi_Agents_TargetsAgent_GetTargetAssignmentForYearAndDimensionAsync_System_Int32_SuperOffice_WebApi_Data_TargetEntityType_SuperOffice_WebApi_Data_TargetLevel_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTargetAssignmentForYearAndDimensionAsync(int, TargetEntityType, TargetLevel, int, int, RequestOptions)
Returns the target assignment for the specified year, entity type and dimension.Parameters
targetYear int
Targeted year
entityType TargetEntityType
Targeted entity type
targetLevel TargetLevel
The level of target the id is referring to.
id int
Contact, UserGroup or Associate id.
dimensionId int
Id of dimension.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetAssignment> Target assignment for a specified entity for year and entity type. Null if not found.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_GetTargetAssignmentForYearAsync_System_Int32_SuperOffice_WebApi_Data_TargetEntityType_SuperOffice_WebApi_Data_TargetLevel_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTargetAssignmentForYearAsync(int, TargetEntityType, TargetLevel, int, RequestOptions)
Returns the target assignment for the specified year and entity type.Parameters
targetYear int
Targeted year
entityType TargetEntityType
Targeted entity type
targetLevel TargetLevel
The level of target the id is referring to.
id int
Contact, UserGroup or Associate id.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetAssignment> Target assignment for a specified entity for year and entity type. Null if not found.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_GetTargetDimensionAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTargetDimensionAsync(int, RequestOptions)
Gets a specific TargetDimension object.Parameters
targetDimensionId int
The identifier of the TargetDimension object
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetDimension> TargetDimension<a id=“SuperOffice_WebApi_Agents_TargetsAgent_GetTargetDimensionsForEntityTypeAsync_SuperOffice_WebApi_Data_TargetEntityType_SuperOffice_WebApi_RequestOptions_”></a> GetTargetDimensionsForEntityTypeAsync(TargetEntityType, RequestOptions)
Returns the target dimensions for the given entity type.Parameters
entityType TargetEntityType
Targeted entity type
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetDimension[]> Target dimensions for year and entity type.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_GetTargetGroupAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTargetGroupAsync(int, RequestOptions)
Gets a specific TargetGroup object.Parameters
targetGroupId int
The identifier of the TargetGroup object
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetGroup> TargetGroup<a id=“SuperOffice_WebApi_Agents_TargetsAgent_GetTargetGroupForYearAndDimensionAsync_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTargetGroupForYearAndDimensionAsync(int, int, RequestOptions)
Returns the target group for the specified year and dimension.Parameters
targetYear int
Targeted year
dimensionId int
Targeted dimension Id
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetGroup> Target Group for year and dimension.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_GetTargetGroupForYearAsync_System_Int32_SuperOffice_WebApi_Data_TargetEntityType_SuperOffice_WebApi_RequestOptions_”></a> GetTargetGroupForYearAsync(int, TargetEntityType, RequestOptions)
Returns the target group for the specified year and entity type.Parameters
targetYear int
Targeted year
entityType TargetEntityType
Targeted entity type
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetGroup> Target Group for year and entity type.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_GetTargetGroupIdsAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTargetGroupIdsAsync(int, RequestOptions)
Returns ids of the target groups that use this dimension.Parameters
targetDimensionId int
The target dimension id
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<int[]> Target group ids.<a id=“SuperOffice_WebApi_Agents_TargetsAgent_GetTargetRevisionHistoryAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetTargetRevisionHistoryAsync(int, RequestOptions)
Returns the revision history for a given TargetAssignmentInfo in chronological order.Parameters
targetAssignmentInfoId int
Target assignment info id
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetRevisionHistory> Target revision history for the given TargetAssignmentInfo<a id=“SuperOffice_WebApi_Agents_TargetsAgent_SaveTargetDimensionAsync_SuperOffice_WebApi_Data_TargetDimension_SuperOffice_WebApi_RequestOptions_”></a> SaveTargetDimensionAsync(TargetDimension, RequestOptions)
Updates the existing TargetDimension or creates a new TargetDimension if the id parameter is 0.Parameters
targetDimension TargetDimension
The TargetDimension that is saved.
requestOptions RequestOptions
Override language/culture codes on this request.
Returns
Task<TargetDimension> New or updated TargetDimension<a id=“SuperOffice_WebApi_Agents_TargetsAgent_SaveTargetGroupAsync_SuperOffice_WebApi_Data_TargetGroup_SuperOffice_WebApi_RequestOptions_”></a> SaveTargetGroupAsync(TargetGroup, RequestOptions)
Updates the existing TargetGroup or creates a new TargetGroup if the id parameter is 0.Parameters
targetGroup TargetGroup
The TargetGroup that is saved.
requestOptions RequestOptions
Override language/culture codes on this request.