> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SuperOffice.WebApi.Agents.IFavouriteAgent

# \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent">\</a> Interface IFavouriteAgent

Namespace: [SuperOffice.WebApi.Agents](SuperOffice.WebApi.Agents.md)\
Assembly: SuperOffice.WebApi.dll

Agent used for retrieveing and setting favourites

```csharp theme={null}
public interface IFavouriteAgent : IAgentBase, IDisposable
```

#### Implements

[IAgentBase](SuperOffice.WebApi.Agents.IAgentBase.md),
[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_AddFavouriteAsync\_System\_String\_System\_Int32\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AddFavouriteAsync(string, int, int, string, RequestOptions)

Add a record in a table as a favourite for an associate

```csharp theme={null}
Task AddFavouriteAsync(string tableName, int recordId, int associateId, string extraInfo, RequestOptions requestOptions = null)
```

#### Parameters

`tableName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Table name, transformed to and from numeric table id by the service layer.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a record in your specified table (tableName)

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a current user

`extraInfo` [string](https://learn.microsoft.com/dotnet/api/system.string)

Any extra information

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_AddFavouritesAsync\_System\_String\_System\_Int32\_\_\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AddFavouritesAsync(string, int\[], int, string, RequestOptions)

Add a list of record ids as favourites for an associate

```csharp theme={null}
Task AddFavouritesAsync(string tableName, int[] recordIds, int associateId, string extraInfo, RequestOptions requestOptions = null)
```

#### Parameters

`tableName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Table name, transformed to and from numeric table id by the service layer.

`recordIds` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Ids of records in your specified table (tableName). Corresponding rows will be added as Favourites.

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a current user

`extraInfo` [string](https://learn.microsoft.com/dotnet/api/system.string)

Any extra information

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_AddTicketsToFavouritesByProviderAsync\_System\_String\_SuperOffice\_WebApi\_Data\_ArchiveRestrictionInfo\_\_\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> AddTicketsToFavouritesByProviderAsync(string, ArchiveRestrictionInfo\[], int, string, RequestOptions)

Add a list of tickets as favourites that are given by the ticket provider.

```csharp theme={null}
Task AddTicketsToFavouritesByProviderAsync(string providerName, ArchiveRestrictionInfo[] restrictions, int associateId, string extraInfo, RequestOptions requestOptions = null)
```

#### Parameters

`providerName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Name of a ticket provider

`restrictions` [ArchiveRestrictionInfo](SuperOffice.WebApi.Data.ArchiveRestrictionInfo.md)\[]

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.

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a current user

`extraInfo` [string](https://learn.microsoft.com/dotnet/api/system.string)

Any extra information

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_GetFavouritesAsync\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetFavouritesAsync(string, int, RequestOptions)

Get all favourites for a table and associate

```csharp theme={null}
Task<Favourite[]> GetFavouritesAsync(string tableName, int associateId, RequestOptions requestOptions = null)
```

#### Parameters

`tableName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Table name, transformed to and from numeric table id by the service layer.

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a current user

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[Favourite](SuperOffice.WebApi.Data.Favourite.md)\[]\&gt;

Requested favourites for a table and associate

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_IsFavouriteAsync\_System\_String\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> IsFavouriteAsync(string, int, int, RequestOptions)

Checks if a record in a table is a favourite for an associate

```csharp theme={null}
Task<bool> IsFavouriteAsync(string tableName, int recordId, int associateId, RequestOptions requestOptions = null)
```

#### Parameters

`tableName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Table name, transformed to and from numeric table id by the service layer.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a record in your specified table (tableName)

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a current user

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\&gt;

Is Favourite?

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_RemoveAllFavouritesAsync\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> RemoveAllFavouritesAsync(string, int, RequestOptions)

Remove all favourites for a table and associate

```csharp theme={null}
Task RemoveAllFavouritesAsync(string tableName, int associateId, RequestOptions requestOptions = null)
```

#### Parameters

`tableName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Table name, transformed to and from numeric table id by the service layer.

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a current user

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_RemoveFavouriteAsync\_System\_String\_System\_Int32\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> RemoveFavouriteAsync(string, int, int, RequestOptions)

Remove favourite for a table, record id and associate

```csharp theme={null}
Task RemoveFavouriteAsync(string tableName, int recordId, int associateId, RequestOptions requestOptions = null)
```

#### Parameters

`tableName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Table name, transformed to and from numeric table id by the service layer.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a record in your specified table (tableName)

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a current user

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_RemoveFavouritesAsync\_System\_String\_System\_Int32\_\_\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> RemoveFavouritesAsync(string, int\[], int, RequestOptions)

Remove a list of record ids from favourites for an associate

```csharp theme={null}
Task RemoveFavouritesAsync(string tableName, int[] recordIds, int associateId, RequestOptions requestOptions = null)
```

#### Parameters

`tableName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Table name, transformed to and from numeric table id by the service layer.

`recordIds` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Ids of records in your specified table (tableName). Corresponding rows will be removed from Favourites.

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a current user

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_RemoveFavouritesByIdAsync\_System\_Int32\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> RemoveFavouritesByIdAsync(int\[], RequestOptions)

Remove favourite using favourite id

```csharp theme={null}
Task RemoveFavouritesByIdAsync(int[] favouriteIds, RequestOptions requestOptions = null)
```

#### Parameters

`favouriteIds` [int](https://learn.microsoft.com/dotnet/api/system.int32)\[]

Ids of favourite rows to delete

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_RemoveTicketsFromFavouritesByProviderAsync\_System\_String\_SuperOffice\_WebApi\_Data\_ArchiveRestrictionInfo\_\_\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> RemoveTicketsFromFavouritesByProviderAsync(string, ArchiveRestrictionInfo\[], int, RequestOptions)

Remove a list of tickets from favourites that are given by the ticket provider.

```csharp theme={null}
Task RemoveTicketsFromFavouritesByProviderAsync(string providerName, ArchiveRestrictionInfo[] restrictions, int associateId, RequestOptions requestOptions = null)
```

#### Parameters

`providerName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Name of a ticket provider

`restrictions` [ArchiveRestrictionInfo](SuperOffice.WebApi.Data.ArchiveRestrictionInfo.md)\[]

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.

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a current user

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_IFavouriteAgent\_ToggleFavouriteAsync\_System\_String\_System\_Int32\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> ToggleFavouriteAsync(string, int, int, string, RequestOptions)

Toggle a record in a table as a favourite for an associate

```csharp theme={null}
Task<bool> ToggleFavouriteAsync(string tableName, int recordId, int associateId, string extraInfo, RequestOptions requestOptions = null)
```

#### Parameters

`tableName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Table name, transformed to and from numeric table id by the service layer.

`recordId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a record in your specified table (tableName)

`associateId` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Id of a current user

`extraInfo` [string](https://learn.microsoft.com/dotnet/api/system.string)

Any extra information

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\&gt;

Return the new value, true if added, false if removed


## Related topics

- [SuperOffice.WebApi.Agents.FavouriteAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.FavouriteAgent.md)
- [SuperOffice.WebApi.Data.Favourite](/en/api/reference/webapi/SuperOffice.WebApi.Data.Favourite.md)
- [SuperOffice.WebApi.Agents.ReportAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ReportAgent.md)
- [SuperOffice.WebApi.Agents.IReportAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.IReportAgent.md)
- [SuperOffice.WebApi.Agents](/en/api/reference/webapi/SuperOffice.WebApi.Agents.md)
- [SuperOffice.WebApi.Agents.ITicketAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ITicketAgent.md)
