---
title: "Interface IWebMClient"
slug: "web-sdk--stylelabs.m.sdk.webclient.iwebmclient"
abstract: ""
---
# Interface IWebMClient

Provides additional features to the default SDK, specifically for HTTP and REST.

## Namespace: StylelabsStylelabs.MSdkWebClient

## Assembly: Stylelabs.M.Sdk.WebClient.dll

## Syntax

```csharp
public interface IWebMClient : IMClient
```

## Properties

### Api

Gets contains functionality to get REST API information. It will also check for compatibility with the server REST API.

#### Declaration

```csharp
IApiClient Api { get; }
```

#### Property Value

| Type | Description |
| --- | --- |
| [IApiClient](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.sdk.webclient.contracts.iapiclient.html) |  |

### ImpersonatedUsername

Gets the name of the user being impersonated. This is null when impersonation is not active.

#### Declaration

```csharp
string ImpersonatedUsername { get; }
```

#### Property Value

| Type | Description |
| --- | --- |
| string |  |

### LinkHelper

Gets contains functionality to build and parse links.

#### Declaration

```csharp
ILinkHelper LinkHelper { get; }
```

#### Property Value

| Type | Description |
| --- | --- |
| [ILinkHelper](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.sdk.webclient.contracts.ilinkhelper.html) |  |

### Package

Gets contains functionality to import and export packages.

#### Declaration

```csharp
IPackageClient Package { get; }
```

#### Property Value

| Type | Description |
| --- | --- |
| IPackageClient |  |

### Raw

Gets contains functionality to do custom HTTP requests.

#### Declaration

```csharp
IRawClient Raw { get; }
```

#### Property Value

| Type | Description |
| --- | --- |
| [IRawClient](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.sdk.webclient.contracts.irawclient.html) |  |

### Uploads

Gets contains functionality for file uploads.

#### Declaration

```csharp
IUploadClient Uploads { get; }
```

#### Property Value

| Type | Description |
| --- | --- |
| [IUploadClient](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.sdk.webclient.contracts.iuploadclient.html) |  |

## Methods

### SetDelegatingHandlerFactory(IDelegatingHandlerFactory)

Sets a factory that will be used to create a System.Net.Http.DelegatingHandler on the first request per specific protocol and host. The handler will be reused for the next requests.

#### Declaration

```csharp
void SetDelegatingHandlerFactory(IDelegatingHandlerFactory factory)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [IDelegatingHandlerFactory](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.sdk.webclient.http.idelegatinghandlerfactory.html) | factory | The http client factory. |

### SetHttpClientFactory(IHttpClientFactory)

Sets a factory that will be used to create a System.Net.Http.HttpClient on the first request per specific protocol and host. The client will be reused for the next requests.

#### Declaration

```csharp
void SetHttpClientFactory(IHttpClientFactory factory)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| [IHttpClientFactory](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.sdk.webclient.http.ihttpclientfactory.html) | factory | The http client factory. |

### SetKnownSSoRedirects(IEnumerable<Uri>)

Set known SSO redirect URls that must trigger security token refreshes.

#### Declaration

```csharp
void SetKnownSSoRedirects(IEnumerable<Uri> ssoRedirects)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
| IEnumerable<>Uri | ssoRedirects | SSO URls. |

### TestConnectionAsync()

Tests the following things:

- if the client can successfully connect to the server
- if the SDK and server are compatible
- if the credentials are correct This will throw exceptions if it failed to connect. The exception type depends on what failed.

#### Declaration

```csharp
Task TestConnectionAsync()
```

#### Returns

| Type | Description |
| --- | --- |
| Task | A representing the asynchronous operation. |

## Events

### RefreshTokenReceived

Triggered when a new refresh-token has been received.

#### Declaration

```csharp
event EventHandler<RefreshTokenReceivedEventArgs> RefreshTokenReceived
```

#### Event Type

| Type | Description |
| --- | --- |
| EventHandler<>[RefreshTokenReceivedEventArgs](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.sdk.webclient.http.refreshtokenreceivedeventargs.html) |  |

### RequestCreated

Triggered when a web-request has been created.

#### Declaration

```csharp
event EventHandler<RequestCreatedEventArgs> RequestCreated
```

#### Event Type

| Type | Description |
| --- | --- |
| EventHandler<>[RequestCreatedEventArgs](https://doc.sitecore.com/ch/en/developers/api-reference/web-sdk--stylelabs.m.sdk.webclient.http.requestcreatedeventargs.html) |  |
