Interface INewsFeedAgent
Interface for the NewsFeed Agent Posting and reading Newsfeed items, marking them as read or as handled.
Experimental: The NewsFeed agent is experimental, subject to change, and not intended for partners.Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("NewsFeed Agent", "Interface for the NewsFeed Agent. Posting and reading Newsfeed items, marking them as read or as handled.")]
public interface INewsFeedAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (NewsFeedAgent agent = new NewsFeedAgent())
{
// call methods on agent here...
}
}
Methods
CreateDefaultNewsFeedItemAsync(CancellationToken)
Loading default values into a new NewsFeedItem.
Experimental: The operation is experimental, subject to change, and not intended for partners.Declaration
Task<NewsFeedItem> CreateDefaultNewsFeedItemAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<NewsFeedItem> | New NewsFeedItem with default values |
DeleteNewsFeedItemAsync(int, CancellationToken)
Deletes the NewsFeedItem
Experimental: The operation is experimental, subject to change, and not intended for partners.Declaration
Task DeleteNewsFeedItemAsync(int newsFeedItemId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | newsFeedItemId | The identity of the NewsFeedItem |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
GetNewsFeedItemAsync(int, CancellationToken)
Gets a NewsFeedItem object.
Experimental: The operation is experimental, subject to change, and not intended for partners.Declaration
Task<NewsFeedItem> GetNewsFeedItemAsync(int newsFeedItemId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | newsFeedItemId | The identifier of the NewsFeedItem object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<NewsFeedItem> | A single NewsFeedItem |
GetNewsFeedItemsByIdAsync(int[], CancellationToken)
Get an array of items from the newsfeed by id. If the current user cannot access a particular item, it will be excluded from the results.
Experimental: The operation is experimental, subject to change, and not intended for partners.Declaration
Task<NewsFeedItem[]> GetNewsFeedItemsByIdAsync(int[] newsFeedItemIds, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | newsFeedItemIds | Ids of the news feed items to mark as seen for this user. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<NewsFeedItem[]> | The news feed items that was posted, or null if not found/not accessible by the user. |
GetNewsItemsForUserAsync(int, DateTime, DateTime, int, int, CancellationToken)
Get a list of newsfeed items for a particular user between two dates. If the current user cannot access a particular item, it will be excluded from the results.
Experimental: The operation is experimental, subject to change, and not intended for partners.Declaration
Task<NewsFeedItem[]> GetNewsItemsForUserAsync(int associateId, DateTime fromDate, DateTime toDate, int top, int skip, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | associateId | Id of the associate to fetch news feed items for. 0 = current user |
| DateTime | fromDate | Start date for fetching news feed items. |
| DateTime | toDate | End date for fetching news feed items. |
| int | top | Maximum number of news feed items to return. |
| int | skip | Number of news feed items to skip for paging. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<NewsFeedItem[]> | The news feed items that was posted, or null if not found/not accessible by the user. |
MarkAsHandledAsync(int, CancellationToken)
Marks the news feed item as handled, so it can be removed from the feed.
Experimental: The operation is experimental, subject to change, and not intended for partners.Declaration
Task<bool> MarkAsHandledAsync(int newsFeedItemId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | newsFeedItemId | Id of the news feed item to mark as handled for all users. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | Indicates if the news feed item was successfully marked as handled. False if it was already handled. |
MarkAsReadAsync(int, CancellationToken)
Marks the news feed item as read, so it can be un-bolded in the current user's feed.
Experimental: The operation is experimental, subject to change, and not intended for partners.Declaration
Task MarkAsReadAsync(int newsFeedItemId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | newsFeedItemId | Id of the news feed item to mark as seen for this user. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
PostNewsFeedItemAsync(NewsFeedItem, int[], int[], bool, CancellationToken)
Saves a new item to the newsfeed, publishing it to the specified users.
Experimental: The operation is experimental, subject to change, and not intended for partners.Declaration
Task<NewsFeedItem> PostNewsFeedItemAsync(NewsFeedItem newsFeedItem, int[] toAssociateIds, int[] toGroupIds, bool toAll, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| NewsFeedItem | newsFeedItem | The news feed item to post. NewsFeedItemId is ignored, as a new id will be generated when posting to the newsfeed. |
| int[] | toAssociateIds | List of associate ids that this news feed item is sent to. |
| int[] | toGroupIds | List of group ids that this news feed item is sent to. This gets resolved to associate ids when posted. |
| bool | toAll | Indicates if this news feed item is sent to all users. Gets resolved into all users when posted. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<NewsFeedItem> | The news feed item that was posted, including its new id. |
StartHandlingAsync(int, CancellationToken)
Marks the news feed item as being handled, that CTA processing has started. i.e. other users should not start handling it also.
Experimental: The operation is experimental, subject to change, and not intended for partners.Declaration
Task<bool> StartHandlingAsync(int newsFeedItemId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | newsFeedItemId | Id of the news feed item to mark as handled for all users. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | Indicates if the news feed item was successfully marked as being handled. False if it was already being handled or was handled. |