Interface IFavouriteAgent
Interface for the Favourite Agent Agent used for retrieveing and setting favourites
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("Favourite Agent", "Interface for the Favourite Agent. Agent used for retrieveing and setting favourites")]
public interface IFavouriteAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (FavouriteAgent agent = new FavouriteAgent())
{
// call methods on agent here...
}
}
Methods
AddFavouriteAsync(string, int, int, string, CancellationToken)
Add a record in a table as a favourite for an associate
Declaration
Task AddFavouriteAsync(string tableName, int recordId, int associateId, string extraInfo, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | Table name, transformed to and from numeric table id by the service layer. |
int | recordId | Id of a record in your specified table (tableName) |
int | associateId | Id of a current user |
string | extraInfo | Any extra information |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | This method has no return value |
AddFavouritesAsync(string, int[], int, string, CancellationToken)
Add a list of record ids as favourites for an associate
Declaration
Task AddFavouritesAsync(string tableName, int[] recordIds, int associateId, string extraInfo, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | Table name, transformed to and from numeric table id by the service layer. |
int[] | recordIds | Ids of records in your specified table (tableName). Corresponding rows will be added as Favourites. |
int | associateId | Id of a current user |
string | extraInfo | Any extra information |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | This method has no return value |
AddTicketsToFavouritesByProviderAsync(string, ArchiveRestrictionInfo[], int, string, CancellationToken)
Add a list of tickets as favourites that are given by the ticket provider.
Declaration
Task AddTicketsToFavouritesByProviderAsync(string providerName, ArchiveRestrictionInfo[] restrictions, int associateId, string extraInfo, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | providerName | Name of a ticket provider |
ArchiveRestrictionInfo[] | restrictions | Query restrictions to be added to provider. Fixed providers, such as LastTicketsProvider, FavouriteTicketsProvider etc. already have mandatory restrictions setup - in such case extra restrictions will be combined, however for general use case for fixed providers you can pass an empty array and provider will return default results. For selection providers generally you should pass selectionId as a restriction. |
int | associateId | Id of a current user |
string | extraInfo | Any extra information |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | This method has no return value |
GetFavouritesAsync(string, int, CancellationToken)
Get all favourites for a table and associate
Declaration
Task<Favourite[]> GetFavouritesAsync(string tableName, int associateId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | Table name, transformed to and from numeric table id by the service layer. |
int | associateId | Id of a current user |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Favourite[]> | Requested favourites for a table and associate |
IsFavouriteAsync(string, int, int, CancellationToken)
Checks if a record in a table is a favourite for an associate
Declaration
Task<bool> IsFavouriteAsync(string tableName, int recordId, int associateId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | Table name, transformed to and from numeric table id by the service layer. |
int | recordId | Id of a record in your specified table (tableName) |
int | associateId | Id of a current user |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | Is Favourite? |
RemoveAllFavouritesAsync(string, int, CancellationToken)
Remove all favourites for a table and associate
Declaration
Task RemoveAllFavouritesAsync(string tableName, int associateId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | Table name, transformed to and from numeric table id by the service layer. |
int | associateId | Id of a current user |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | This method has no return value |
RemoveFavouriteAsync(string, int, int, CancellationToken)
Remove favourite for a table, record id and associate
Declaration
Task RemoveFavouriteAsync(string tableName, int recordId, int associateId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | Table name, transformed to and from numeric table id by the service layer. |
int | recordId | Id of a record in your specified table (tableName) |
int | associateId | Id of a current user |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | This method has no return value |
RemoveFavouritesAsync(string, int[], int, CancellationToken)
Remove a list of record ids from favourites for an associate
Declaration
Task RemoveFavouritesAsync(string tableName, int[] recordIds, int associateId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | Table name, transformed to and from numeric table id by the service layer. |
int[] | recordIds | Ids of records in your specified table (tableName). Corresponding rows will be removed from Favourites. |
int | associateId | Id of a current user |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | This method has no return value |
RemoveFavouritesByIdAsync(int[], CancellationToken)
Remove favourite using favourite id
Declaration
Task RemoveFavouritesByIdAsync(int[] favouriteIds, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int[] | favouriteIds | Ids of favourite rows to delete |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | This method has no return value |
RemoveTicketsFromFavouritesByProviderAsync(string, ArchiveRestrictionInfo[], int, CancellationToken)
Remove a list of tickets from favourites that are given by the ticket provider.
Declaration
Task RemoveTicketsFromFavouritesByProviderAsync(string providerName, ArchiveRestrictionInfo[] restrictions, int associateId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | providerName | Name of a ticket provider |
ArchiveRestrictionInfo[] | restrictions | Query restrictions to be added to provider. Fixed providers, such as LastTicketsProvider, FavouriteTicketsProvider etc. already have mandatory restrictions setup - in such case extra restrictions will be combined, however for general use case for fixed providers you can pass an empty array and provider will return default results. For selection providers generally you should pass selectionId as a restriction. |
int | associateId | Id of a current user |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | This method has no return value |
ToggleFavouriteAsync(string, int, int, string, CancellationToken)
Toggle a record in a table as a favourite for an associate
Declaration
Task<bool> ToggleFavouriteAsync(string tableName, int recordId, int associateId, string extraInfo, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | tableName | Table name, transformed to and from numeric table id by the service layer. |
int | recordId | Id of a record in your specified table (tableName) |
int | associateId | Id of a current user |
string | extraInfo | Any extra information |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<bool> | Return the new value, true if added, false if removed |