> ## 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.PocketAgent

# \<a id="SuperOffice\_WebApi\_Agents\_PocketAgent">\</a> Class PocketAgent

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

Agent with Pocket specific functionality

```csharp theme={null}
public class PocketAgent : AgentBase, IPocketAgent, IAgentBase, IDisposable
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[AgentBase](SuperOffice.WebApi.Agents.AgentBase.md) ←
[PocketAgent](SuperOffice.WebApi.Agents.PocketAgent.md)

#### Implements

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

#### Inherited Members

[AgentBase.\_json](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__json),
[AgentBase.\_binary](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__binary),
[AgentBase.\_config](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__config),
[AgentBase.\_client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__client),
[AgentBase.\_disposeClient](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase__disposeClient),
[AgentBase.Merge(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Merge_SuperOffice_WebApi_RequestOptions_),
[AgentBase.BuildRequestFromObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromStream(HttpMethod, string, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromStream_System_Net_Http_HttpMethod_System_String_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.BuildRequestFromObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_BuildRequestFromObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.ParseAuthorization(IAuthorization)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseAuthorization_SuperOffice_WebApi_Authorization_IAuthorization_),
[AgentBase.CancelRequest()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_CancelRequest),
[AgentBase.SendRequestObject(HttpMethod, string, object, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObject_System_Net_Http_HttpMethod_System_String_System_Object_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequestObjectWithStream(HttpMethod, string, object, Stream, WebApiOptions, string)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequestObjectWithStream_System_Net_Http_HttpMethod_System_String_System_Object_System_IO_Stream_SuperOffice_WebApi_WebApiOptions_System_String_),
[AgentBase.SendRequest(HttpRequestMessage, RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_SendRequest_System_Net_Http_HttpRequestMessage_SuperOffice_WebApi_RequestOptions_),
[AgentBase.ThrowOnResponseErrorAsync(HttpRequestMessage, HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ThrowOnResponseErrorAsync_System_Net_Http_HttpRequestMessage_System_Net_Http_HttpResponseMessage_),
[AgentBase.ParseResponse\<T\&gt;(HttpResponseMessage)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ParseResponse__1_System_Net_Http_HttpResponseMessage_),
[AgentBase.Finally(RequestOptions)](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Finally_SuperOffice_WebApi_RequestOptions_),
[AgentBase.Dispose()](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Dispose),
[AgentBase.Configuration](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Configuration),
[AgentBase.Client](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_Client),
[AgentBase.HasRunningRequest](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_HasRunningRequest),
[AgentBase.ClientCancellationTokenSource](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ClientCancellationTokenSource),
[AgentBase.ProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_ProgressListener),
[AgentBase.UploadProgressListener](SuperOffice.WebApi.Agents.AgentBase.md#SuperOffice_WebApi_Agents_AgentBase_UploadProgressListener),
[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring),
[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)),
[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)),
[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

## Examples

\<pre>\<code class="lang-csharp">using SuperOffice.WebApi;
using SuperOffice.WebApi.Agents;

var mySession = new WebApiOptions("[http://example.com/super/api](http://example.com/super/api)");
mySession.Authorization = new AuthorizationUsernamePassword("user", "pass");
using (PocketAgent agent = new PocketAgent(mySession))
\{
// call methods on agent here...
}\</code>\</pre>

## Constructors

### \<a id="SuperOffice\_WebApi\_Agents\_PocketAgent\_\_ctor\_System\_Net\_Http\_HttpClient\_">\</a> PocketAgent(HttpClient)

Constructor: Agent with Pocket specific functionality

```csharp theme={null}
public PocketAgent(HttpClient httpClient)
```

#### Parameters

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Use this HTTP client instead of making own HttpClient instance.

### \<a id="SuperOffice\_WebApi\_Agents\_PocketAgent\_\_ctor\_SuperOffice\_WebApi\_WebApiOptions\_System\_Net\_Http\_HttpClient\_">\</a> PocketAgent(WebApiOptions, HttpClient)

Constructor: Agent with Pocket specific functionality

```csharp theme={null}
public PocketAgent(WebApiOptions options, HttpClient httpClient = null)
```

#### Parameters

`options` [WebApiOptions](SuperOffice.WebApi.WebApiOptions.md)

Base URL and authentication values.

`httpClient` [HttpClient](https://learn.microsoft.com/dotnet/api/system.net.http.httpclient)

Optional: Use this HTTP client instead of making a new one.

## Methods

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

Get caller ids from a selection. Queries the shadow selection of persons and companies, so selections of any kind can be used

```csharp theme={null}
public Task<CallerIDCollection> GetCallerIDsFromSelectionAsync(int selectionId, string lastHash, RequestOptions requestOptions = null)
```

#### Parameters

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

Id of selection to get caller ids from

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

Hash for the previous call, used for checking if the same set of caller ids was sent in an earlier call, and returning null in that case

`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)\<[CallerIDCollection](SuperOffice.WebApi.Data.CallerIDCollection.md)\&gt;

Collection of caller IDs, containing the hash of the caller ids

### \<a id="SuperOffice\_WebApi\_Agents\_PocketAgent\_GetMyCallerIDsAsync\_System\_String\_System\_DateTime\_System\_DateTime\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetMyCallerIDsAsync(string, DateTime, DateTime, RequestOptions)

Get caller ids that the current principal might be interested in (phone numbers of related persons in sales and appointments created/owned/touched by ourselves or colleagues in our primary group

```csharp theme={null}
public Task<CallerIDCollection> GetMyCallerIDsAsync(string lastHash, DateTime minDate, DateTime maxDate, RequestOptions requestOptions = null)
```

#### Parameters

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

Hash for the previous call, used for checking if the same set of caller ids was sent in a previous call, and returning null in that case

`minDate` [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

Only check activities after this date

`maxDate` [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

Only check activities before this date

`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)\<[CallerIDCollection](SuperOffice.WebApi.Data.CallerIDCollection.md)\&gt;

Collection of caller IDs, containing the hash of the caller ids

### \<a id="SuperOffice\_WebApi\_Agents\_PocketAgent\_GetPocketStartupDataAsync\_System\_String\_\_\_System\_DateTime\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetPocketStartupDataAsync(string\[], DateTime, RequestOptions)

```csharp theme={null}
public Task<PocketStartupData> GetPocketStartupDataAsync(string[] tables, DateTime currentClientTime, RequestOptions requestOptions = null)
```

#### Parameters

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

Tables to check for license

`currentClientTime` [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

Current time on the client, used for overdue sale lookup having correct timezone relative to client

`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)\<[PocketStartupData](SuperOffice.WebApi.Data.PocketStartupData.md)\&gt;

Startup data for pocket

### \<a id="SuperOffice\_WebApi\_Agents\_PocketAgent\_GetPushNotificationTagsForDeviceAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetPushNotificationTagsForDeviceAsync(string, RequestOptions)

Retrieve current tag value for a device

```csharp theme={null}
public Task<string> GetPushNotificationTagsForDeviceAsync(string deviceIdentifier, RequestOptions requestOptions = null)
```

#### Parameters

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

The unique identifier of this device

`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)\<[string](https://learn.microsoft.com/dotnet/api/system.string)\&gt;

A comma separated list of events this device should receive push events for

### \<a id="SuperOffice\_WebApi\_Agents\_PocketAgent\_GetRegisteredDevicesAsync\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetRegisteredDevicesAsync(int, RequestOptions)

Retrieve all registered devices for an associate

```csharp theme={null}
public Task<PocketDeviceInfo[]> GetRegisteredDevicesAsync(int associateId, RequestOptions requestOptions = null)
```

#### Parameters

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

The user to get devices for

`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)\<[PocketDeviceInfo](SuperOffice.WebApi.Data.PocketDeviceInfo.md)\[]\&gt;

### \<a id="SuperOffice\_WebApi\_Agents\_PocketAgent\_NotificationHandledAsync\_SuperOffice\_WebApi\_Data\_NotificationEventType\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> NotificationHandledAsync(NotificationEventType, int, RequestOptions)

Mark a notification as handled, so it can be cleaned up on other clients that have received the notification

```csharp theme={null}
public Task NotificationHandledAsync(NotificationEventType notificationEventType, int id, RequestOptions requestOptions = null)
```

#### Parameters

`notificationEventType` [NotificationEventType](SuperOffice.WebApi.Data.NotificationEventType.md)

Type of notification

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

Id of entity to notify about

`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\_PocketAgent\_NotificationsHandledAsync\_SuperOffice\_WebApi\_Data\_NotificationEvent\_\_\_SuperOffice\_WebApi\_RequestOptions\_">\</a> NotificationsHandledAsync(NotificationEvent\[], RequestOptions)

Mark a set of notifications as handled, so they can be cleaned up on other clients that have received the notification

```csharp theme={null}
public Task NotificationsHandledAsync(NotificationEvent[] notificationEvents, RequestOptions requestOptions = null)
```

#### Parameters

`notificationEvents` [NotificationEvent](SuperOffice.WebApi.Data.NotificationEvent.md)\[]

List of notifications to mark as handled

`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\_PocketAgent\_NotifyUsersAsync\_SuperOffice\_WebApi\_Data\_NotificationEventType\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> NotifyUsersAsync(NotificationEventType, int, RequestOptions)

Notify users about a new or changed entity

```csharp theme={null}
public Task NotifyUsersAsync(NotificationEventType notificationEventType, int id, RequestOptions requestOptions = null)
```

#### Parameters

`notificationEventType` [NotificationEventType](SuperOffice.WebApi.Data.NotificationEventType.md)

Type of notification

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

Id of entity to notify about

`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\_PocketAgent\_RegisterDeviceForPushNotificationAsync\_SuperOffice\_WebApi\_Data\_PocketDeviceInfo\_SuperOffice\_WebApi\_RequestOptions\_">\</a> RegisterDeviceForPushNotificationAsync(PocketDeviceInfo, RequestOptions)

Register a device that should receive push notifications when notable events occour

```csharp theme={null}
public Task RegisterDeviceForPushNotificationAsync(PocketDeviceInfo deviceInfo, RequestOptions requestOptions = null)
```

#### Parameters

`deviceInfo` [PocketDeviceInfo](SuperOffice.WebApi.Data.PocketDeviceInfo.md)

Properties for the device to register

`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\_PocketAgent\_RunAppointmentAlarmBrokerAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> RunAppointmentAlarmBrokerAsync(RequestOptions)

Execute the AppointmentAlarmBroker once

```csharp theme={null}
public Task RunAppointmentAlarmBrokerAsync(RequestOptions requestOptions = null)
```

#### Parameters

`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\_PocketAgent\_SendPushNotificationAsync\_System\_Int32\_\_\_SuperOffice\_WebApi\_Data\_PocketNotificationMessage\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SendPushNotificationAsync(int\[], PocketNotificationMessage, RequestOptions)

Send a push notification to one or more associates

```csharp theme={null}
public Task SendPushNotificationAsync(int[] associateIds, PocketNotificationMessage message, RequestOptions requestOptions = null)
```

#### Parameters

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

The associates to send the push notification message to

`message` [PocketNotificationMessage](SuperOffice.WebApi.Data.PocketNotificationMessage.md)

The message to send

`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\_PocketAgent\_SetPushNotificationTagsForDeviceAsync\_System\_String\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SetPushNotificationTagsForDeviceAsync(string, string, RequestOptions)

Specify what kind of notification events a device should receive push notifications for

```csharp theme={null}
public Task SetPushNotificationTagsForDeviceAsync(string deviceIdentifier, string tags, RequestOptions requestOptions = null)
```

#### Parameters

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

The unique identifier for a device

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

A comma separated list of events this device should receive push events for

`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\_PocketAgent\_SetPushNotificationTagsForUserAsync\_System\_Int32\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SetPushNotificationTagsForUserAsync(int, string, RequestOptions)

Specify what kind of notification events a user should receive push notifications for.  This will update all registerred devices for this user.

```csharp theme={null}
public Task SetPushNotificationTagsForUserAsync(int associateId, string tags, RequestOptions requestOptions = null)
```

#### Parameters

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

The associate to set tags for

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

A comma separated list of events the associate should receive push events for

`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


## Related topics

- [SuperOffice.WebApi.Data.PocketDeviceInfo](/en/api/reference/webapi/SuperOffice.WebApi.Data.PocketDeviceInfo.md)
- [SuperOffice.WebApi.Data.PocketNotificationMessage](/en/api/reference/webapi/SuperOffice.WebApi.Data.PocketNotificationMessage.md)
- [SuperOffice.WebApi.Data.PocketStartupData](/en/api/reference/webapi/SuperOffice.WebApi.Data.PocketStartupData.md)
- [SuperOffice.WebApi.Data.CallerID](/en/api/reference/webapi/SuperOffice.WebApi.Data.CallerID.md)
- [SuperOffice.WebApi.Data.CallerIDCollection](/en/api/reference/webapi/SuperOffice.WebApi.Data.CallerIDCollection.md)
- [SuperOffice.WebApi.Data.NotificationEvent](/en/api/reference/webapi/SuperOffice.WebApi.Data.NotificationEvent.md)
