Skip to main content

<a id=“SuperOffice_WebApi_Agents_MarketingAgent”></a> Class MarketingAgent

Namespace: SuperOffice.WebApi.Agents
Assembly: SuperOffice.WebApi.dll
Agent used for Marketing functions, such as Forms

Inheritance

objectAgentBaseMarketingAgent

Implements

IMarketingAgent, 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 (MarketingAgent agent = new MarketingAgent(mySession)) { // call methods on agent here… }</code></pre>

Constructors

<a id=“SuperOffice_WebApi_Agents_MarketingAgent__ctor_System_Net_Http_HttpClient_”></a> MarketingAgent(HttpClient)

Constructor: Agent used for Marketing functions, such as Forms

Parameters

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

<a id=“SuperOffice_WebApi_Agents_MarketingAgent__ctor_SuperOffice_WebApi_WebApiOptions_System_Net_Http_HttpClient_”></a> MarketingAgent(WebApiOptions, HttpClient)

Constructor: Agent used for Marketing functions, such as Forms

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_MarketingAgent_CalculateMailingStatisticsAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> CalculateMailingStatisticsAsync(int, RequestOptions)

Calculate open and click rates for one or more mailings

Parameters

shipmentId int If 0, calculate rates for all dirty (are_statistics_dirty) shipments requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; Number of shipments updated with calculated statistics

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_CreateDefaultAvailableFontAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultAvailableFontAsync(RequestOptions)

Create an return an empty font

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AvailableFont&gt; Returns the created default font

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_CreateDefaultFormEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultFormEntityAsync(RequestOptions)

Set default values into a new FormEntity. NetServer calculates default values on the entity, which is required when creating/storing a new instance

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<FormEntity&gt; A blank FormEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_CreateDefaultFormSubmissionEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultFormSubmissionEntityAsync(RequestOptions)

Set default values into a new FormSubmissionEntity. NetServer calculates default values on the entity, which is required when creating/storing a new instance

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<FormSubmissionEntity&gt; A blank FormSubmissionEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_CreateDefaultShipmentMessageBlockEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultShipmentMessageBlockEntityAsync(RequestOptions)

Set default values into a new ShipmentMessageBlockEntity. NetServer calculates default values on the entity, which is required when creating/storing a new instance

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ShipmentMessageBlockEntity&gt; A blank ShipmentMessageBlockEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_CreateDefaultShipmentMessageEntityAsync_SuperOffice_WebApi_RequestOptions_”></a> CreateDefaultShipmentMessageEntityAsync(RequestOptions)

Set default values into a new ShipmentMessageEntity. NetServer calculates default values on the entity, which is required when creating/storing a new instance

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ShipmentMessageEntity&gt; A blank ShipmentMessageEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_DeleteAvailableFontAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteAvailableFontAsync(int, RequestOptions)

Delete the font with the provided id

Parameters

availableFontId int The id of the font to delete requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<bool&gt; Returns true if the font was deleted

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_DeleteFormEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteFormEntityAsync(int, RequestOptions)

Deletes the FormEntity

Parameters

formEntityId int The identity of the FormEntity requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_DeleteFormSubmissionEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteFormSubmissionEntityAsync(int, RequestOptions)

Deletes the FormSubmissionEntity

Parameters

formSubmissionEntityId int The identity of the FormSubmissionEntity requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_DeleteMessageAndShipmentAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteMessageAndShipmentAsync(int, RequestOptions)

Delete the message and the shipment the message (MessageId) belongs to

Parameters

messageId int Message id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_DeleteShipmentMessageBlockEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteShipmentMessageBlockEntityAsync(int, RequestOptions)

Deletes the ShipmentMessageBlockEntity

Parameters

shipmentMessageBlockEntityId int The identity of the ShipmentMessageBlockEntity requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_DeleteShipmentMessageEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> DeleteShipmentMessageEntityAsync(int, RequestOptions)

Deletes the ShipmentMessageEntity

Parameters

shipmentMessageEntityId int The identity of the ShipmentMessageEntity requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_GetAvailableFontAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetAvailableFontAsync(int, RequestOptions)

Get an available font by id

Parameters

availableFontId int The id of the font to retrieve requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AvailableFont&gt; Returns the requested font or null if it does not exist

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_GetFormEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetFormEntityAsync(int, RequestOptions)

Gets a specific FormEntity object.

Parameters

formEntityId int The identifier of the FormEntity object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<FormEntity&gt; FormEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_GetFormSubmissionEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetFormSubmissionEntityAsync(int, RequestOptions)

Gets a specific FormSubmissionEntity object.

Parameters

formSubmissionEntityId int The identifier of the FormSubmissionEntity object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<FormSubmissionEntity&gt; FormSubmissionEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_GetFormSubmissionsCountAsync_System_Int32_SuperOffice_WebApi_Data_FormSubmissionStatus_SuperOffice_WebApi_RequestOptions_”></a> GetFormSubmissionsCountAsync(int, FormSubmissionStatus, RequestOptions)

Get counnt of submissions for given form and status. Count for all forms is returned if negative formId is given

Parameters

formId int If 0 or less, return count for all forms status FormSubmissionStatus Which status the submissions should have. If Unknown, return count of all statuses requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<int&gt; Number of formsubmissions

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_GetPreviewMailingAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPreviewMailingAsync(int, RequestOptions)

Get a shipment message from its shipment address id

Parameters

shipmentAddrId int Shipment address id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<PreviewMailing&gt; PreviewMailing

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_GetPreviewMailingHeaderAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetPreviewMailingHeaderAsync(int, RequestOptions)

Get a shipment from its shipment id

Parameters

shipmentId int Shipment id requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<PreviewMailingHeader&gt; PreviewMailingHeader

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_GetShipmentMessageBlockEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetShipmentMessageBlockEntityAsync(int, RequestOptions)

Gets a specific ShipmentMessageBlockEntity object.

Parameters

shipmentMessageBlockEntityId int The identifier of the ShipmentMessageBlockEntity object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ShipmentMessageBlockEntity&gt; ShipmentMessageBlockEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_GetShipmentMessageEntityAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetShipmentMessageEntityAsync(int, RequestOptions)

Gets a specific ShipmentMessageEntity object.

Parameters

shipmentMessageEntityId int The identifier of the ShipmentMessageEntity object requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ShipmentMessageEntity&gt; ShipmentMessageEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_GetUserBlocksAsync_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> GetUserBlocksAsync(int, RequestOptions)

Get the saved user blocks to be used in a shipment/mailing message

Parameters

associateId int The associate id to get the user blocks. 0 will get all saved blocks requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ShipmentMessageBlockEntity[]&gt; An array of user blocks

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_RenameMailingByMessageIdAsync_System_Int32_System_String_SuperOffice_WebApi_RequestOptions_”></a> RenameMailingByMessageIdAsync(int, string, RequestOptions)

Change the mailing name (shipment description) that the given message (MessageId) belongs to

Parameters

messageId int Message id name string The new name requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_SaveAvailableFontAsync_SuperOffice_WebApi_Data_AvailableFont_SuperOffice_WebApi_RequestOptions_”></a> SaveAvailableFontAsync(AvailableFont, RequestOptions)

Saves the font and returns it with correct rank

Parameters

font AvailableFont The font to save requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<AvailableFont&gt; Returns the saved font with correct rank

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_SaveFormEntityAsync_SuperOffice_WebApi_Data_FormEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveFormEntityAsync(FormEntity, RequestOptions)

Updates the existing FormEntity or creates a new FormEntity if the id parameter is 0.

Parameters

formEntity FormEntity The FormEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<FormEntity&gt; New or updated FormEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_SaveFormSubmissionEntityAsync_SuperOffice_WebApi_Data_FormSubmissionEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveFormSubmissionEntityAsync(FormSubmissionEntity, RequestOptions)

Updates the existing FormSubmissionEntity or creates a new FormSubmissionEntity if the id parameter is 0.

Parameters

formSubmissionEntity FormSubmissionEntity The FormSubmissionEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<FormSubmissionEntity&gt; New or updated FormSubmissionEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_SaveShipmentMessageBlockEntityAsync_SuperOffice_WebApi_Data_ShipmentMessageBlockEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveShipmentMessageBlockEntityAsync(ShipmentMessageBlockEntity, RequestOptions)

Updates the existing ShipmentMessageBlockEntity or creates a new ShipmentMessageBlockEntity if the id parameter is 0.

Parameters

shipmentMessageBlockEntity ShipmentMessageBlockEntity The ShipmentMessageBlockEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ShipmentMessageBlockEntity&gt; New or updated ShipmentMessageBlockEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_SaveShipmentMessageEntityAsync_SuperOffice_WebApi_Data_ShipmentMessageEntity_SuperOffice_WebApi_RequestOptions_”></a> SaveShipmentMessageEntityAsync(ShipmentMessageEntity, RequestOptions)

Updates the existing ShipmentMessageEntity or creates a new ShipmentMessageEntity if the id parameter is 0.

Parameters

shipmentMessageEntity ShipmentMessageEntity The ShipmentMessageEntity that is saved. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<ShipmentMessageEntity&gt; New or updated ShipmentMessageEntity

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_SetAllFormFieldRestrictionsAsync_SuperOffice_WebApi_Data_FormFieldRestriction___SuperOffice_WebApi_RequestOptions_”></a> SetAllFormFieldRestrictionsAsync(FormFieldRestriction[], RequestOptions)

Sets the list of form field restrictions. Note: This list is the conclusion of what should exist in the table. Restrictions that already exists in the table are edited, new ones are added, and if they are not in this list, they will be deleted

Parameters

formFieldRestrictions FormFieldRestriction[] All the restrictions to set. Restrictions not included, will be deleted requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_SetFontRankAsync_System_Int32_System_Int32_SuperOffice_WebApi_RequestOptions_”></a> SetFontRankAsync(int, int, RequestOptions)

Set the rank on the font and reorder the rest of the fonts accordingly

Parameters

availableFontId int The id of the available font to set the rank on rank int The new rank to set on the font requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<bool&gt; Returns true if the new rank on the font and surrounding reranks went well

<a id=“SuperOffice_WebApi_Agents_MarketingAgent_VerifyGoogleRecaptchaAsync_System_String_System_String_SuperOffice_WebApi_RequestOptions_”></a> VerifyGoogleRecaptchaAsync(string, string, RequestOptions)

This method will try to verify a Google recaptcha token. The token is gained from the recaptcha frontend component

Parameters

token string The token to be verified optionalSecretKey string Use an optional secret key instead of the system wide requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<bool&gt; Returns true if the recaptcha token verified successfully