Interface IMarketingAgent
Interface for the Marketing Agent Agent used for Marketing functions, such as Forms
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("Marketing Agent", "Interface for the Marketing Agent. Agent used for Marketing functions, such as Forms")]
public interface IMarketingAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (MarketingAgent agent = new MarketingAgent())
{
// call methods on agent here...
}
}
Methods
CalculateMailingStatisticsAsync(int, CancellationToken)
Calculate open and click rates for one or more mailings
Declaration
Task<int> CalculateMailingStatisticsAsync(int shipmentId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | shipmentId | If 0, calculate rates for all dirty (are_statistics_dirty) shipments |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | Number of shipments updated with calculated statistics |
CreateDefaultAvailableFontAsync(CancellationToken)
Create an return an empty font
Declaration
Task<AvailableFont> CreateDefaultAvailableFontAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<AvailableFont> | Returns the created default font |
CreateDefaultFormEntityAsync(CancellationToken)
Loading default values into a new FormEntity.
Declaration
Task<FormEntity> CreateDefaultFormEntityAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<FormEntity> | New FormEntity with default values |
CreateDefaultFormSubmissionEntityAsync(CancellationToken)
Loading default values into a new FormSubmissionEntity.
Declaration
Task<FormSubmissionEntity> CreateDefaultFormSubmissionEntityAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<FormSubmissionEntity> | New FormSubmissionEntity with default values |
CreateDefaultShipmentMessageBlockEntityAsync(CancellationToken)
Loading default values into a new ShipmentMessageBlockEntity.
Declaration
Task<ShipmentMessageBlockEntity> CreateDefaultShipmentMessageBlockEntityAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ShipmentMessageBlockEntity> | New ShipmentMessageBlockEntity with default values |
CreateDefaultShipmentMessageEntityAsync(CancellationToken)
Loading default values into a new ShipmentMessageEntity.
Declaration
Task<ShipmentMessageEntity> CreateDefaultShipmentMessageEntityAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ShipmentMessageEntity> | New ShipmentMessageEntity with default values |
DeleteAvailableFontAsync(int, CancellationToken)
Delete the font with the provided id
Declaration
Task<bool> DeleteAvailableFontAsync(int availableFontId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | availableFontId | The id of the font to delete |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | Returns true if the font was deleted |
DeleteFormEntityAsync(int, CancellationToken)
Deletes the FormEntity
Declaration
Task DeleteFormEntityAsync(int formEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | formEntityId | The identity of the FormEntity |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
DeleteFormSubmissionEntityAsync(int, CancellationToken)
Deletes the FormSubmissionEntity
Declaration
Task DeleteFormSubmissionEntityAsync(int formSubmissionEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | formSubmissionEntityId | The identity of the FormSubmissionEntity |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
DeleteMessageAndShipmentAsync(int, CancellationToken)
Delete the message and the shipment the message (MessageId) belongs to
Declaration
Task DeleteMessageAndShipmentAsync(int messageId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | messageId | Message id |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
DeleteShipmentMessageBlockEntityAsync(int, CancellationToken)
Deletes the ShipmentMessageBlockEntity
Declaration
Task DeleteShipmentMessageBlockEntityAsync(int shipmentMessageBlockEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | shipmentMessageBlockEntityId | The identity of the ShipmentMessageBlockEntity |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
DeleteShipmentMessageEntityAsync(int, CancellationToken)
Deletes the ShipmentMessageEntity
Declaration
Task DeleteShipmentMessageEntityAsync(int shipmentMessageEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | shipmentMessageEntityId | The identity of the ShipmentMessageEntity |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
GetAvailableFontAsync(int, CancellationToken)
Get an available font by id
Declaration
Task<AvailableFont> GetAvailableFontAsync(int availableFontId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | availableFontId | The id of the font to retrieve |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<AvailableFont> | Returns the requested font or null if it does not exist |
GetFormEntityAsync(int, CancellationToken)
Gets a FormEntity object.
Declaration
Task<FormEntity> GetFormEntityAsync(int formEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | formEntityId | The identifier of the FormEntity object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<FormEntity> | A single FormEntity |
GetFormSubmissionEntityAsync(int, CancellationToken)
Gets a FormSubmissionEntity object.
Declaration
Task<FormSubmissionEntity> GetFormSubmissionEntityAsync(int formSubmissionEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | formSubmissionEntityId | The identifier of the FormSubmissionEntity object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<FormSubmissionEntity> | A single FormSubmissionEntity |
GetFormSubmissionsCountAsync(int, FormSubmissionStatus, CancellationToken)
Get counnt of submissions for given form and status. Count for all forms is returned if negative formId is given
Declaration
Task<int> GetFormSubmissionsCountAsync(int formId, FormSubmissionStatus status, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | formId | If 0 or less, return count for all forms |
| FormSubmissionStatus | status | Which status the submissions should have. If Unknown, return count of all statuses |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | Number of formsubmissions |
GetPreviewMailingAsync(int, CancellationToken)
Get a shipment message from its shipment address id
Declaration
Task<PreviewMailing> GetPreviewMailingAsync(int shipmentAddrId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | shipmentAddrId | Shipment address id |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PreviewMailing> | PreviewMailing |
GetPreviewMailingHeaderAsync(int, CancellationToken)
Get a shipment from its shipment id
Declaration
Task<PreviewMailingHeader> GetPreviewMailingHeaderAsync(int shipmentId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | shipmentId | Shipment id |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PreviewMailingHeader> | PreviewMailingHeader |
GetShipmentMessageBlockEntityAsync(int, CancellationToken)
Gets a ShipmentMessageBlockEntity object.
Declaration
Task<ShipmentMessageBlockEntity> GetShipmentMessageBlockEntityAsync(int shipmentMessageBlockEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | shipmentMessageBlockEntityId | The identifier of the ShipmentMessageBlockEntity object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ShipmentMessageBlockEntity> | A single ShipmentMessageBlockEntity |
GetShipmentMessageEntityAsync(int, CancellationToken)
Gets a ShipmentMessageEntity object.
Declaration
Task<ShipmentMessageEntity> GetShipmentMessageEntityAsync(int shipmentMessageEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | shipmentMessageEntityId | The identifier of the ShipmentMessageEntity object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ShipmentMessageEntity> | A single ShipmentMessageEntity |
GetUserBlocksAsync(int, CancellationToken)
Get the saved user blocks to be used in a shipment/mailing message
Declaration
Task<ShipmentMessageBlockEntity[]> GetUserBlocksAsync(int associateId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | associateId | The associate id to get the user blocks. 0 will get all saved blocks |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ShipmentMessageBlockEntity[]> | An array of user blocks |
RenameMailingByMessageIdAsync(int, string, CancellationToken)
Change the mailing name (shipment description) that the given message (MessageId) belongs to
Declaration
Task RenameMailingByMessageIdAsync(int messageId, string name, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | messageId | Message id |
| string | name | The new name |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
SaveAvailableFontAsync(AvailableFont, CancellationToken)
Saves the font and returns it with correct rank
Declaration
Task<AvailableFont> SaveAvailableFontAsync(AvailableFont font, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AvailableFont | font | The font to save |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<AvailableFont> | Returns the saved font with correct rank |
SaveFormEntityAsync(FormEntity, CancellationToken)
Updates the existing FormEntity or creates a new FormEntity if the id parameter is 0.
Declaration
Task<FormEntity> SaveFormEntityAsync(FormEntity formEntity, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FormEntity | formEntity | The FormEntity that is saved |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<FormEntity> | New or updated FormEntity |
SaveFormSubmissionEntityAsync(FormSubmissionEntity, CancellationToken)
Updates the existing FormSubmissionEntity or creates a new FormSubmissionEntity if the id parameter is 0.
Declaration
Task<FormSubmissionEntity> SaveFormSubmissionEntityAsync(FormSubmissionEntity formSubmissionEntity, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FormSubmissionEntity | formSubmissionEntity | The FormSubmissionEntity that is saved |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<FormSubmissionEntity> | New or updated FormSubmissionEntity |
SaveShipmentMessageBlockEntityAsync(ShipmentMessageBlockEntity, CancellationToken)
Updates the existing ShipmentMessageBlockEntity or creates a new ShipmentMessageBlockEntity if the id parameter is 0.
Declaration
Task<ShipmentMessageBlockEntity> SaveShipmentMessageBlockEntityAsync(ShipmentMessageBlockEntity shipmentMessageBlockEntity, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ShipmentMessageBlockEntity | shipmentMessageBlockEntity | The ShipmentMessageBlockEntity that is saved |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ShipmentMessageBlockEntity> | New or updated ShipmentMessageBlockEntity |
SaveShipmentMessageEntityAsync(ShipmentMessageEntity, CancellationToken)
Updates the existing ShipmentMessageEntity or creates a new ShipmentMessageEntity if the id parameter is 0.
Declaration
Task<ShipmentMessageEntity> SaveShipmentMessageEntityAsync(ShipmentMessageEntity shipmentMessageEntity, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ShipmentMessageEntity | shipmentMessageEntity | The ShipmentMessageEntity that is saved |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ShipmentMessageEntity> | New or updated ShipmentMessageEntity |
SetAllFormFieldRestrictionsAsync(FormFieldRestriction[], CancellationToken)
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
Declaration
Task SetAllFormFieldRestrictionsAsync(FormFieldRestriction[] formFieldRestrictions, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| FormFieldRestriction[] | formFieldRestrictions | All the restrictions to set. Restrictions not included, will be deleted |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
SetFontRankAsync(int, int, CancellationToken)
Set the rank on the font and reorder the rest of the fonts accordingly
Declaration
Task<bool> SetFontRankAsync(int availableFontId, int rank, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | availableFontId | The id of the available font to set the rank on |
| int | rank | The new rank to set on the font |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | Returns true if the new rank on the font and surrounding reranks went well |
VerifyGoogleRecaptchaAsync(string, string, CancellationToken)
This method will try to verify a Google recaptcha token. The token is gained from the recaptcha frontend component
Declaration
Task<bool> VerifyGoogleRecaptchaAsync(string token, string optionalSecretKey, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | token | The token to be verified |
| string | optionalSecretKey | Use an optional secret key instead of the system wide |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | Returns true if the recaptcha token verified successfully |