> For the complete documentation index, see [llms.txt](https://docs.patchmypc.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/customer-and-connections.md). Agents can also search and read this documentation through its [MCP server](https://docs.patchmypc.com/~gitbook/mcp).

# Customer information and connections

SDK methods for reading your account information and limits, and for listing and selecting connections.

[Back to the Cloud Customer API overview](https://docs.patchmypc.com/patch-my-pc-cloud-api)

These methods read information about your Patch My PC account and manage the connection the SDK works with. A connection links your Patch My PC account to a Microsoft Intune tenant. Deployment, deployment template, and public catalog methods run against the selected connection, so select one before you call them.

All of these methods need an authenticated session. For details, see [SDK authentication methods](https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/authentication.md).

## Models

### Customer information

`CustomerInfoDto` (namespace `PatchMyPC.Cloud.Client`) describes your account.

| Property                   | Type     | Description                                                                                                                     |
| -------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `CustomerId`               | `Guid`   | Your customer ID.                                                                                                               |
| `CustomerName`             | `string` | Your company name.                                                                                                              |
| `License`                  | object   | Your license details.                                                                                                           |
| `Limits`                   | object   | The limits that apply to your account, for example how many custom applications you can create.                                 |
| `LimitsProgress`           | object   | Your current usage against those limits.                                                                                        |
| `MacOSApplicationsEnabled` | `bool`   | `true` if your account is entitled to macOS applications. When it's `false`, searches for macOS applications return no results. |

### Connection

`ConnectionDto` (namespace `PatchMyPC.Cloud.Client`) describes one connection.

| Property       | Type      | Description                                                                                                                        |
| -------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `ConnectionId` | `Guid`    | The connection ID. Pass it wherever a method asks for a connection ID.                                                             |
| `DisplayName`  | `string?` | The connection's display name, if one is set.                                                                                      |
| `Type`         | enum      | The connection type. Only Intune connections are returned.                                                                         |
| `AdminConsent` | enum      | Whether an administrator has granted consent for the connection. Deployment operations fail on a connection without admin consent. |

## Methods

### GetCustomerInfoAsync

Gets your account information and usage limits.

{% code collapsedlinecount="10" %}

```csharp
Task<Result<CustomerInfoDto>> GetCustomerInfoAsync(CancellationToken cancellationToken = default);
```

{% endcode %}

| Parameter           | Type                | Description                 |
| ------------------- | ------------------- | --------------------------- |
| `cancellationToken` | `CancellationToken` | Optional. Cancels the call. |

**Returns:** a [`CustomerInfoDto`](#customer-information) for your company.

The personal access token (PAT) needs the `appcatbroker:customer:read` scope.

{% code collapsedlinecount="10" %}

```csharp
var info = await client.GetCustomerInfoAsync();
if (info.IsFailure)
{
    Console.WriteLine($"Couldn't read account information: {info.Error.Message}");
    return;
}

Console.WriteLine($"{info.Value.CustomerName} ({info.Value.CustomerId})");
Console.WriteLine($"macOS applications enabled: {info.Value.MacOSApplicationsEnabled}");
```

{% endcode %}

**See also:** [Get-PmpcCustomerInfo](https://docs.patchmypc.com/patch-my-pc-cloud-api/powershell/get-pmpccustomerinfo.md) and [Get customer info](https://docs.patchmypc.com/patch-my-pc-cloud-api/rest-api/applications.md#get-customer-info).

### GetAvailableConnectionsAsync

Lists the Intune connections for your company.

{% code collapsedlinecount="10" %}

```csharp
Task<Result<IReadOnlyList<ConnectionDto>>> GetAvailableConnectionsAsync(CancellationToken cancellationToken = default);
```

{% endcode %}

| Parameter           | Type                | Description                 |
| ------------------- | ------------------- | --------------------------- |
| `cancellationToken` | `CancellationToken` | Optional. Cancels the call. |

**Returns:** a list of [`ConnectionDto`](#connection) objects. The list is empty if the company has no Intune connections.

A PAT needs the `appcatbroker:apps:read` scope.

{% code collapsedlinecount="10" %}

```csharp
var connections = await client.GetAvailableConnectionsAsync();
if (connections.IsFailure)
{
    Console.WriteLine($"Couldn't list connections: {connections.Error.Code} {connections.Error.Message}");
    return;
}

foreach (var connection in connections.Value)
{
    Console.WriteLine($"{connection.DisplayName} ({connection.ConnectionId}) consent: {connection.AdminConsent}");
}
```

{% endcode %}

**See also:** [Get-PmpcConnection](https://docs.patchmypc.com/patch-my-pc-cloud-api/powershell/get-pmpcconnection.md) and [Get available connections](https://docs.patchmypc.com/patch-my-pc-cloud-api/rest-api/applications.md#get-available-connections).

### SetSelectedConnectionAsync

Selects the connection that deployment, deployment template, and public catalog methods use.

{% code collapsedlinecount="10" %}

```csharp
Task<Result> SetSelectedConnectionAsync(ConnectionDto selectedConnection);
```

{% endcode %}

| Parameter            | Type                           | Description                                                                  |
| -------------------- | ------------------------------ | ---------------------------------------------------------------------------- |
| `selectedConnection` | [`ConnectionDto`](#connection) | Required. One of the connections returned by `GetAvailableConnectionsAsync`. |

**Returns:** a `Result` that indicates success or failure. Passing `null` fails with `VALIDATION_ERROR`.

Selecting a connection doesn't change the session's company. The SDK applies the selected connection automatically to deployment create and edit requests, overwriting any connection ID you set on the request. Until you select a connection, deployment methods fail with `VALIDATION_ERROR` and the message "No connection selected. Please call SetSelectedConnectionAsync first."

{% code collapsedlinecount="10" %}

```csharp
var connection = connections.Value.FirstOrDefault(c => c.DisplayName == "{connection-name}");
if (connection is null)
{
    Console.WriteLine("Connection not found.");
    return;
}

var select = await client.SetSelectedConnectionAsync(connection);
if (select.IsFailure)
{
    Console.WriteLine($"Couldn't select the connection: {select.Error.Message}");
    return;
}
```

{% endcode %}

**See also:** [Set-PmpcConnection](https://docs.patchmypc.com/patch-my-pc-cloud-api/powershell/set-pmpcconnection.md). This method has no REST operation; the selection is stored in the SDK.

### GetSelectedConnection

Returns the currently selected connection.

{% code collapsedlinecount="10" %}

```csharp
ConnectionDto? GetSelectedConnection();
```

{% endcode %}

This method has no parameters.

**Returns:** the selected [`ConnectionDto`](#connection), or `null` if no connection is selected. Unlike most methods, it returns the value directly rather than a result object.

{% code collapsedlinecount="10" %}

```csharp
var current = client.GetSelectedConnection();
Console.WriteLine(current is null
    ? "No connection selected."
    : $"Using connection {current.DisplayName} ({current.ConnectionId})");
```

{% endcode %}

**See also:** [Get-PmpcSelectedConnection](https://docs.patchmypc.com/patch-my-pc-cloud-api/powershell/get-pmpcselectedconnection.md). This method has no REST operation; it reads the selection stored in the SDK.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.patchmypc.com/patch-my-pc-cloud-api/sdk/customer-and-connections.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
